>> 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?
>
> This is a question about JS today? Obviously (as discussed on twitter) people
> have to be aware. ("hi" instanceof String) is false and must be.
Good point. They have to understand that String is not a constructor for
(primitive) strings.
> Again, are you suggesting a retrofit along the lines I diagrammed, so that
> ("hi" instanceof string) would be true?
I don’t have a definite answer for how to best fix this, but it would be lovely
if we could. I find it challenging myself ATM and pity newcomers. So I’m
insisting more on the problem than on my solution.
>> 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.).
>
> I championed generic functions for ES4, remember?
True. ;-)
>> 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).
>
> That's all fine but again: not ES7. First, operators for value objects.
Makes sense. Maybe the syntax/API for setting up operators can be designed in a
way that keeps the option open of adding complete multiple dispatch later (or
via a library).
--
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