3 ms·
Presumably they intended to say that the (1) cplusplus thing can express something that Rust cannot, and (2) here’s an example of Thing. But then they didn’t pr
by avgcorrection 4y ago
Presumably they intended to say that the (1) cplusplus thing can express something that Rust cannot, and (2) here’s an example of Thing. But then they didn’t properly delineate the two things so that it might come off as if (2) is an argument for (1), but really (1) just talks about Thing in isolation and not as a comparison to Rust... The example was just a standalone example, unrelated to Rust.
- ncmncm 4y agoIf 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.