String.prototype.localeCompare is worthless.

Changing atropa.arrays.sortAlphabetically to throw an error.

The results of String.prototype.localeCompare are implementation dependent so, fuck using it at all. While there is a new implementation accepting a couple more arguments to specify the locale, I haven't researched it enough to know whether or not these new extra arguments are standardized and implemented widely. If I get verification that there is some standard so I can expect the same output on all platforms then I'll implement atropa.arrays.sortAlphabetically again. In the meantime it's going to throw an error because I'm too lazy to add in static arrays of locale charsets and implement my own version of localeCompare. I had no idea that "alphabetical order" was subject to interpretation. Seems like whatever dictionary is considered the standard for a locale would have already standardized the sort order for words in that locale and we shouldn't have this issue in JavaScript at all.

See:
https://github.com/matthewkastor/AtropaToolbox-raw-js/commit/aa0b439626428c41918149a681c64aa11856e8be
for commit details.

See:
http://www.ecma-international.org/ecma-262/5.1/#sec-15.5.4.9
for the standard regarding String.prototype.localeCompare

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.