Allen Wirfs-Brock wrote:
> Not to pick a fight (yet), but that's a bit strong. Recall I'm proposing
value objects with operators dispatching 2-ary functions based on arguments, in a
way that is inline-cacheable. Still working on it (Christian Hansen helping),
update anon.
Sure, but that is dynamic type based dispatching with caching, not static
declarative overloading
That it's dynamic does not mean the form used when defining operator
multimethods can't be declarative syntax.
We need to separate static syntax, which I think is better for defining
operators (in classes, value class or regular class), and static
overload resolution. Agree we can't have the latter.
We could do static describe overloads of primitive types (and probably value
types).
And *definitely* value types -- or to your "dynamic" point, value objects.
Where the usual attempts at describing overloads for JS go wrong is it they
either ignore dynamic coercions or forget in in real JS code they would happen
after the overload selection. WebIDL address this by building performing
(known) coercions into its overload selection algorithm. But I don't think any
human JS programer would do it the way it does.
Agreed, although it smells that WebIDL has this kind of overloading at
all when JS doesn't. We need to avoid elaborating it, if it is legacy
sunk-cost and provided it doesn't infect engines or impose too much
hardship on self-hosted overloaded DOM methods, or on JSIDL.
/be
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss