Re:The Next Step for Generics
by Someone on Tuesday June 16, 2020 @05:16PM
(#23544247)
That’s true, but both rust (https://doc.rust-lang.org/beta/std/cmp/trait.Eq.html) and Haskell (https://hackage.haskell.org/package/base-4.12.0.0/docs/Data-...) use eq or similar for what this proposal calls comparable, as do C# (IEquatable), java (through Object.equals), and Swift (Equatable)
[ Parent
| on HN ]
Sure, but as someone else already pointed out, “comparable” is an established Go term that refers to “==“ and “!=“ only, and “ordered” refers to the other comparison operators.
My point was that “comparable” is not universally used in place of the “Ordered” term that the Go team is using, as you were seemingly implying. Ordered is a perfectly fine term for it.
You said:
> Using comparable here closes the door for adding that later.
But the door is not closed in any way. It’s just called “constraints.Ordered”, which is perfectly reasonable.