The more I think about it, the more I want a user-specified comparison function. Efficiency should not be an issue here - the engines should tweek the JIT compiler to fix any efficiency issues. Just let the user pass a closure (remember functions are first-class in JavaScript so this is not a callback nor an event).
Keean. On 2 May 2011 19:57, Aryeh Gregor <[email protected]> wrote: > On Fri, Apr 29, 2011 at 3:19 PM, Keean Schupke <[email protected]> wrote: > > As long as we have a binary mode I am happy. > > Something I didn't think to mention: what exactly is "binary mode" for > DOMStrings? I guess it means you encode as big-endian UTF-16, then > sort bytewise? This is kind of evil, but it matches what sort() does, > so I guess it should be the required behavior. (It's kind of evil > because it doesn't match code-point order, unlike if you encoded as > UTF-8. E.g., U+10000 is encoded as 0xd800dc00 and U+E000 is 0xe000, > so U+E000 sorts after U+10000.) > > Perhaps this should be spelled out more clearly in the spec. >
