2 ms·
The ability to provide inline comparison function for Sort() is welcome. It's one of those infrequently needed language niceties that have (at least for me) mad
by bostik 10y ago
The ability to provide inline comparison function for Sort() is welcome. It's one of those infrequently needed language niceties that have (at least for me) made perl and python so slick to use.
Sorting arrays of objects or small hashes, based on arbitrary properties/keys, is quite useful.
- yxhuvud 10y agoYou are not really responding to the comment you are replying to, though. Yes, being able to do custom sorting is nice, but no-one challenged that claim. The type system really doesn't look very nice when it won't even manage type safety in such a simple case as this. Also, compared to other languages that is in sort of a similar spot[* ], such as Swift or Crystal that both manage type safe custom sort functions, it looks even worse. [*] That is, modern languages that compile down to native code while having some basic way of avoiding manual memory management.