ARGUMENTS.SHOULD.BE.ARRAY bug-fix

Brendan Eich brendan at mozilla.org
Mon Mar 19 11:24:21 PDT 2007


On Mar 19, 2007, at 11:10 AM, Jeff Dyer wrote:

>> Thank you for considering this. While I can imagine why this
>> functionality was disabled in ES1-3 (to protect programmer from
>> misprints), in typed language typer could be responsible for handling
>> this, not grammar.
>> Well, let's wait for Jeff to comment.
>
> I'm not sure the type system will help much since 'undefined' will
> silently convert to a value of most types. An argument list with holes
> looks like mistake to me. Why not force the user to say what he means?

Agreed. The type checker is an optional strict mode, anyway, so it  
can't help catch mistakes even if hole is not compatible with  
undefined or other typed values.

Note also that holes in arrays mean the property need not be  
allocated, which can save memory and survive hole-preserving  
operations. Not so with actual parameters or the arguments object, at  
least not in any implementation I know of. An arguments object is not  
an Array.

>> Probably named parameters were already considered, in this case I'm
>> sorry for disturbing, just failed to find it in spec.
>
> Named arguments has been discussed from time to time, but never had  
> the
> support to become a serious proposal. Both proposals here are future
> proof and so I say let's hold off for now. We need to have  
> something to
> talk about when edition4 is done :)

Agreed. Waldemar had these at one point, but we need to finish soon,  
so leaving things out is important -- especially when they can be  
done by object initialiser argument passing and destructuring formal  
parameters.

/be



More information about the Es4-discuss mailing list