archives

« Bugzilla Issues Index

#3150 — Array.p.sort needs to take impure ToString operator into account


(This also applies to the ES6 draft.)

The second condition defining when the characteristics of a sort result does not make sense in general. SortCompare invokes ToString, which could be arbitrarily impure. In particular, it might return arbitrary different results on each call.

There probably needs to be language making the result of sort implementation-dependent when the ToString for any of the array elements is not a constant function.


added conditions to ES6 rev34 draft


Fixed in ES2015.