On 03/18/2016 11:10, Tab Atkins Jr. wrote:
If you're planning on pessimistically assuming that legacy
implementations use an unstable sort for Array#sort(), then testing
for the presence of Array#fastSort() (and assuming that when it
appears the Array#sort is stable) is exactly as useful as testing for
the presence of Array#stableSort (and assuming that when it appears
the Array#sort is unstable/fast).  So, polyfilling isn't a reason to
prefer one default vs the other.

That makes no sense.  The presence of fastSort does not indicate that sort is 
stable.

The approach of sometimes using "sort" for unstable sort and sometimes for 
stable sort would cause too much confusion.  Which sort are you getting when you call 
sort?  If you want a sort that's guaranteed stable, call stableSort.

The argument that stable sort should have the shorter name doesn't hold much 
water either.  C++ defines sorts named sort and stable_sort (as well as a few 
others) just fine.  sort is by far the more popular one (by a factor of 20!) 
because most applications don't actually care about stability.

    Waldemar

_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to