On Nov 10, 2013, at 4:53 PM, Brendan Eich wrote:

> Allen Wirfs-Brock wrote:
>> I think the only sort of declarative overloading that is appropriate for JS 
>> is based upon the number of actually passed arguments (and nothing else).
> 
> 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

We could do static describe overloads of primitive types (and probably value 
types).  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.

Allen


_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to