My last entry about what to do with sort in scalar context generated some new proposals. Rather than rebut them one by one, here's a short mental gauntlet for any proposal to run though:
* If sort() should do X, why not map and grep?
* Why not use a user defined function?
* Will it help in the common "return sort
* Can you think of common cases where you want to write a function which returns the entire list in list context but only do X in scalar?
Let's take, for example, the proposal to have sort return whether the list was sorted.
* It makes no sense for map and grep.
* It is easily done as a user defined function.
* It doesn't help at all with the "return sort" gotcha.
* I can't think of any reason why I'd write a function that returns either a list or the fact that some internal list is sorted.
That one's shooting fish in a barrel for example purposes. Another was to return either the first or last element of the sorted list and also to return an iterator. I leave those to the reader as its late and I'm tired.