Guards are now ready for discussion (was: Nov 18 notes)

Brendan Eich brendan at mozilla.com
Mon Nov 22 11:33:41 PST 2010


On Nov 22, 2010, at 11:12 AM, Brendan Eich wrote:

>> Would keyword arguments ever be added to JS?  Any chance that would influence the choices made here?
> 
> Imponderable unless we reserve : in call expressions such as
> 
> foo(arg1: val1, arg3: val3);
> 
> to mean named formal parameter association -- keyword arguments if I understand what you meant by that. Yet this is both too close to an object initialiser

by which I mean: what's the point? Just pass an object initialiser to a function that destructures it. Can be optimized to avoid constructing an object, in advanced implementations. But whatever the optimization, the language is crowded if we have both of

foo(arg1: val1, arg3: val3);

and today's works-in-all-browsers form:

foo({arg1: val1, arg3: val3});

Is losing the braces really worth the added complexity?

/be



More information about the es-discuss mailing list