Handle binary selectors in Symbol >> #asSortFunction. As long as we do not officially deprecate Symbol >> #value:value:, the current state is a bit disappointing.
'hello' sorted: #<=> asSortFunction.
"...in the past, we needed to write all this prose instead:"
'hello' sorted: [:someCharacter :someOtherCharacter | someCharacter <=> someOtherCharacter] asSortFunction.
=============== Diff against Collections-eem.944 ===============
Item was changed:
----- Method: Symbol>>asSortFunction (in category '*Collections-SortFunctions-converting') -----
+ "Return a SortFunction around the receiver. If the receiver is a 2-arg symbol, it is assumed it will do the collation directly itself, returning -1, 0, or 1. If the receiver is a one-arg symbol, it will be evaluated for each a and b and of the sort input, and the result of sending <=> to those will be used."
+ self numArgs = 0 ifTrue: [^PropertySortFunction property: self].
+ self numArgs = 1 ifTrue: [^CollatorBlockFunction usingBlock: self].
- "Return a SortFunction around the receiver, where the receiver will be used as a unary message to send to both a and b during sorting, and then the result of said send will be collated in ascending order using the <=> method."
- "#('abc' 'de' 'fghi') sorted: #size ascending >>> #('de' 'abc' 'fghi')"
+ self error: 'Cant be converted to sort function. It should has one or two args'.!
- ^PropertySortFunction property: self!