Then there is the natural sorting order, which you can read more about in this essay by Jeff Atwood.
Yes, there is the naïve lexicographical sort by raw Unicode code point that you're supporting then there is locale-aware lexicographical sorting - alphabetical order varies between languages, so if you want things properly sorted in alphabetical order, you will need to use a collation specific to your language, and you can't rely on the naïve numeric values of the characters.
What is natural for you might be natural for me but not for someone else. > I wonder what you think 'natural number sorting' is and is not. > Do you agree that there is a clear and well understood set of rules that have been in place for decades on how strings are to be sorted? It is just that I strongly disagree and hope very much it is not implemented. I don't think it is stupid or anything like that. And as a bonus we don't cruft up the ST code with junk.Īnyway I think we have both made our positions clear and I certainly think yours is a position worthy of respect. Neither of these cases apply if we just accept the arbitrary constraint of using the raw string sorting of the base language. String sorting may well be arbitrary and annoying and all those sorts of things but a simple, clear and deterministic set of well understood rules is my preference over getting 'cute' with more 'clever' schemes.ģ - "Can you come up with a scenario where natural number sorting would result in sublime sorting incorrectly, but lexicographical sorting would not?" Yep here are two very obvious cases:ġ : any case where what you think is 'natural' i think is 'unnatural'Ģ : any case where the attempt to apply one or more 'clever' 'natural' sorting algorithms has an implementation bug - I have huge respect for Jon but he is human and is therefore capable of coding a bug. I am happy to stick with the well understood behaviour of how string sorting works to avoid any clashes with whatever each person might consider 'natural' and 'unnatural' (whatever those terms mean). What about RTL languages, what about, what about. There are no real surprises there and the fewer surprises my computer presents me with the happier I am.Ģ - I wonder what you think 'natural number sorting' is and is not. Does taking the words I am using in context make my point clearer? Do you agree that there is a clear and well understood set of rules that have been in place for decades on how strings are to be sorted? They may be crude and brutal and arbitrary and even annoying but we all know what they are without thinking about it very much.
So I am referring not to 'normal' but to 'normal string'.
The phrase being used is 'normal string' sorting. Well yes I agree there is no more meaning to 'normal' than to 'natural' in terms of sorting.