2 ms·
The exact spelling of correct use of concepts differs from in the example code, but dwelling on it distracts from the valuable point. It is not correct to say
by ncmncm 4y ago
The exact spelling of correct use of concepts differs from in the example code, but dwelling on it distracts from the valuable point.
It is not correct to say that C++ concepts are duck-typed. They can be used in a sort of duck-typed way, if you choose to. But it is not the normal way to use them. And, using them only as far as Rust's built-in checking can go wastes most of their expressive power, which is unavailable to Rust coders.
- tialaramex 4y ago> dwelling on it distracts from the valuable point. You brought up an entirely imaginary situation because you misread the C++ code. > It is not correct to say that C++ concepts are duck-typed. The actual mechanism delivered is duck typing. Rust comes with Eq and C++ 20 comes with std::equality_comparable. The former has semantics, Rust only provides implementation of Eq on types which exhibit equivalence, however C++ provides numerous types which match the concept std::equality_comparable despite not exhibiting equivalence, because all it does is check the != and == operators are present. Would you prefer to say it's "structural typing"? Because the trouble is that it doesn't (and shouldn't) do all of what structural typing does, that's why "duck typing" is the correct phrase.
- ncmncm 4y agoYou are confusing limited use in certain Standard Library components with what concepts are able to do. Duck typing is, as I said, strictly optional. Where that is used in the Standard Library thus far, it improves upon the experience of legacy usage. Doubling down when you have been corrected adds only heat, not light.
- tialaramex 4y ago> Doubling down when you have been corrected adds only heat, not light. All I've done is reported the facts, and, aside from hallucinating concepts in an example which didn't use them you've just insisted the facts aren't true. I've provided examples like Ord and Eq, and you've provided nothing but denial. Nobody can do anything with that. The reason you find all those Concepts in the Standard Library with duck typing is that it's what Concepts do. If not for the duck typing they might as well just be comments. Was that all you were getting at? Look at this fancy new comment syntax?
- ncmncm 4y agoYou were corrected. It is your responsibility to learn better.