>> But maybe it’s the best we can do. > > There is no total class hierarchy describing all values in JS. If you think > we should retrofit one, make that case.
There is a subclass relationship between types in JavaScript. instanceof is aware of it, typeof isn’t. So I think my complaint is better phrased like this: Why do people have to be aware of the difference between primitives and objects when it comes to choosing between typeof and instanceof? > Much as I am a fan of dead languages with multimethods, I'd rather leave it > at this for ES7. I understand and agree with the desire to keep the language small. That is a very good argument against multiple dispatch (MD). But I don’t see how it matters whether languages using MD are dead or not (which they are not: Clojure is popular, Stroustrup has written a proposal for adding them to C++, etc.). MD is very useful for working with data (web services, JSON, etc.), where you don’t want to (or can’t) encapsulate behavior with data. Design-wise, they make functions aware of object-orientation so that you can use them to implement algorithms that span multiple classes (as binary operators do). -- Dr. Axel Rauschmayer [email protected] home: rauschma.de twitter: twitter.com/rauschma blog: 2ality.com
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

