3 ms·
If you read what it says, you will see that it says Rust has built-in the most trivial of the things that concepts are used to do, and cannot express the rest a
by ncmncm 4y ago
If you read what it says, you will see that it says Rust has built-in the most trivial of the things that concepts are used to do, and cannot express the rest at all.
- tialaramex 4y agoRust's traits actually reflect semantics, which is what you want, whereas C++ concepts are duck typing and you just get lots of wishful thinking when (too often) that's not enough. Take a look at Eq for example. Eq is a trait that inherits from PartialEq but has no actual syntactic requirements. It reflects equivalence. Choosing to implement Eq is a claim about equivalence for your type. It has semantics. With C++ concepts you'd have to invent a marker for that purpose, and so C++ does not have any equivalent to Eq. Instead it offers std::equality_comparable which models equivalence but only deliver syntactic matching on the != and == operators like Rust's PartialEq.
- ncmncm 4y agoIt is clear you do not understand the concepts feature in C++, so cannot meaningfully compare it to anything in Rust. It is no sin not to understand something, unless you go on to pontificate about it.
- avgcorrection 4y agoI’m sorry man I can’t read.