2017-11-07 9:23 GMT+01:00 Nicolas Cellier < nicolas.cellier.aka.nice@gmail.com>:
I have other ideas yet.
The selector undefinedFirst is good, but the implementation not so. I don't like the UndefinedSortFunction: too specific, compose oddly...
If we defined <=> in Boolean (orWhatEverTheLongSelectorYouPr eferBecausePharoHasTheFreedomToHaveOwnTaste:) in order to have true sorted first, then we can generalize.
"sort by absolute value, but put the negative first" numbers sorted: #negative sortedFirst, #abs
sortedFirst in this case would be a synonym for ascending (or asSortFunction). Alternatively, if we don't want <=> in Boolean because it's not natural (the fact that we need a synonym is a clue) then we can have sortedFirst answering a specialized BooleanSortFunction.
I like this idea. And I think it is better to add threeWayCompare: to Boolean because it allows to avoid extra selector: #negative ascending, #abs #isNil descending, #name
From the other side it will force remembering convention for boolean order. So maybe it should be explicit:
#negative trueFirst, #abs #isNil trueLast, #name