Hi there! I've picked up this issue related to implementing a new Sort
ability for comparisons between types.
One conclusion from earlier discussion is that Sort
should not be implemented by Str
, because it would be ambiguous, and another in the issue is that it's fine to initially not have it for F32
and F64
either (similar to Eq
). That all makes sense!
Got a couple of other questions that I could use some guidance on:
Sort
for arbitrary types, similar to Eq
?<
, <=
, >
, >=
work using Sort
?Sort
to live in? A new one? List
?Jasper Woudenberg said:
Do we want auto-derived
Sort
for arbitrary types, similar toEq
?
yes!
Should
<
,<=
,>
,>=
work usingSort
?
I don't think so - I think they should continue to use Num
. It's always seemed like a footgun to me that in many languages I can write "chair" < "hamburger"
and have the type checker accept it. I think it's best if that's a mismatch! :big_smile:
Which module would we like
Sort
to live in? A new one?List
?
let's put it in List
for now and see how that feels :thumbs_up:
Isn't "chair" < "hamburger"
only a problem cause string sorting is ambiguous?
it's not just a problem of "what's the answer" it's also a problem of "this is not code that should be written this way on purpose" :big_smile:
but it can of course absolutely be written this way by mistake
so the combination of "shouldn't be written this way on purpose" and "the compiler can tell you when you've written it this way, in case you've made a mistake" leads me to the preference of wanting it to be a compiler error
Last updated: Jul 06 2025 at 12:14 UTC