Array#sort() implementations not interoperable

Brendan Eich brendan at mozilla.org
Mon Dec 3 10:46:46 PST 2012


Jussi Kalliokoski wrote:
> Hello everyone,
>
> Reposting, I think my previous attempt got stuck in a filter or 
> something, because I somehow managed to have the code there in several 
> copies.

You have three messages total on this topic at

https://mail.mozilla.org/pipermail/es-discuss/2012-December/


> I was thinking about sorting algorithms yesterday and I realized that 
> ES implementations may have different sorting algorithms in use, and 
> decided to try it out. Now, if you sort strings or numbers, it doesn't 
> matter, but you may be sorting objects by a key and this is where 
> things get nasty (think non-deterministic vs deterministic). 

Have you read the language dating from ES3 on Array sort in the spec? In 
particular Array#sort is not guaranteed to be stable. Perhaps it should be.

/be



More information about the es-discuss mailing list