Thank you for the explanation.

Is there any way to make 'array.sort(coll.compare)' work on my side (in C++) or
is that the way sort() is supposed to work no matter what? It seems that the
latter is the case, but I'd better ask you to make sure.

I guess many callers want to define their own compare function any way because
they're likely to compare more complex objects than simple strings. For
instance, a file browser may want to list directories before regular files and
would use the following:

var compareFileName = function(a, b) {
   if (a.type == b.type) { return coll.compare(a.name, b.name);}
   if (a.type =="directory") return -1;
   return 1;
}

So, not being able to directly pass coll.compare() is probably ok. However, if
there's any way to make it possible, pls let me know.


http://codereview.chromium.org/6673011/

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to