undefined being treated as a missing optional argument

David Herman dherman at mozilla.com
Fri Apr 13 11:22:50 PDT 2012


On Apr 13, 2012, at 10:53 AM, Allen Wirfs-Brock wrote:

> On Apr 13, 2012, at 10:10 AM, Brendan Eich wrote:
> 
>> In general, delegation (depth D) plus optionality (degree N paramters) makes an (2N)^D worst-case combinatorial explosion.
>> 
>> This is IMHO a strong argument for a sentinel in-language to mean "missing actual".
> 
> That sentinel could simply be a empty argument position:
> 
>          new Intl.Collator( , {usage: "search"});

That's not enough. It doesn't allow you to make a dynamic decision as to whether or not to pass that argument, which still leaves you in general with the combinatorial explosion.

I'm very much in favor of defaults treating undefined exactly the same as no argument.

Dave



More information about the es-discuss mailing list