Re:Rue: Higher level than Rust, lower level than Go
by chuckadams on Monday December 22, 2025 @12:32PM
(#46356325)
Protected and private inheritance are C++'s equivalent to traits, and they don't suffer from the usual issues of multiple inheritance. As for type classes, check out concepts. By no means am I trying to sell C++, I don't touch it myself, but it doesn't leave you completely adrift in those seas.
[ Parent
| on HN ]
Re:Rue: Higher level than Rust, lower level than Go
by amluto on Monday December 22, 2025 @07:09PM
(#46360837)
> Protected and private inheritance are C++'s equivalent to traits
How so? Maybe in a COM-like world where the user of an object needs to call a method to get an interface pointer.
I’ll grant that concepts are a massive improvement.
Re:Rue: Higher level than Rust, lower level than Go
by chuckadams on Tuesday December 23, 2025 @10:10AM
(#46365880)
In the sense of supporting mixins that don't necessarily pollute your public API. The overlap with other languages isn't perfect, and traits in the stdlib refer to a rather different template-based thing, but I don't think any language has the monopoly on a canon definition of traits. Certainly they're going to be different than traits in Self, which iirc coined the term.