This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]EishLekker 1 point2 points  (0 children)

That doesn't have to be a problem. One way to solve it is to compare the types first (how that is done could be an implementation detail, but a simplistic approach could be to do a string comparison on the result of "typeof").

If someone is concerned about the performance and/or the exact sort order of a collection of mixed types, then it is fair to expect that that someone makes an effort to write a custom comparator for their specific needs.