Array.prototype.sort: order and moment of the [[Get]]/[[Set]] calls

Till Schneidereit till at
Mon Aug 18 04:46:05 PDT 2014

On Mon, Aug 18, 2014 at 1:32 PM, Claude Pache <claude.pache at>

> Le 18 août 2014 à 12:59, Till Schneidereit <till at> a
> écrit :
> >
> > Note also that, by my reading of the spec at least, all implementations
> currently fully adhere to the spec: they "[p]erform an
> implementation-dependent sequence of calls to the [[Get]] and [[Set]]
> internal methods of obj, to the DeletePropertyOrThrow abstract operation
> with obj as the first argument, and to SortCompare". My reading of this is
> that "implementation-denendent sequence" refers to all four mentioned
> functions, where an implementation might either intermix all of them (like
> v8/JSC do) or first do a (sub-)sequence of only [[Get]] calls and then a
> second (sub-)sequence intermixing calls to all the other functions (like
> Chakra/SpiderMonkey).
> >
> Nit: As currently specced, SortCompare includes obligatory calls to
> [[HasProperty]] and [[Get]] on some keys before invoking the comparison
> function: so, SpiderMonkey/Chakra don't adhere to the specs. Even JSC/V8
> don't fully adhere to the spec on this point, because (as I've observed)
> they may omit a call to [[HasProperty]]/[[Get]] when the value is known.
> But I think it is a spec bug that can be corrected, in order to make all
> current implementations compliant (SortCompare should take the values, not
> the keys, as arguments).

Oh, you're right. And I agree: SortCompare should take values.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list