undefined being treated as a missing optional argument

Brendan Eich brendan at mozilla.org
Fri Apr 13 14:37:28 PDT 2012

Allen Wirfs-Brock wrote:
> On Apr 13, 2012, at 12:16 PM, Brendan Eich wrote:
>> No one wants to add yet another bottom type and singleton value.
> Permitting "holes" in argument lists, eg Intl.Collator( , {usage:"search"})
> doesn't require either at the user language level or the specification level. Whether a sentinel value would be needed to represent holes in argument lists at the implementation level is entirely an implement issue just like it is for sparse arrays.

I don't think it's that easy. Your example showing hasOwnProperty 
testing points to one problem. Without a very convenient 
is-this-value-a-hole predicate, people will push back against the need 
to test for holes in rest parameters or (shudder) arguments objects.

The big-picture objection is that holes in arrays do not justify holes 
in argument lists. Arguably holes in arrays are a botch, or at least 
over-exposed (e.g. by array extras and generic built-ins). Why propagate 
one botch into a new domain?


More information about the es-discuss mailing list