On Fri, Jul 12, 2013 at 11:20 AM, Tab Atkins Jr. <[email protected]> wrote:
> On Thu, Jul 11, 2013 at 9:22 PM, Andrew Fedoniouk
> <[email protected]> wrote:
>> Quite often I see constructions like this:
>>
>> foo({one:1,two:2});
>>
>> so call of function with single parameter - object literal.
>> Idiom named "Poor man named arguments passing"
>>
>> Idea is to extend existing JS/ES syntax calls to support
>> simple form of the call above:
>>
>> foo {one:1,two:2 };
>>
>> Semi-formally that syntax looks like:
>>
>> function-call:
>> <name-token> '(' <parameter-list> ')' // existing form
>> <name-token> <object-literal> // proposal
>>
>> This syntax extension will not break correct pre-ES6 code
>> as far as I can tell. But I am not sure about new ES6 arrivals.
>>
....
>>
>> Just to reduce that bracketing noise in syntax.
>
> I'm not a fan of this, because it only gets us part of the way toward
> the benefits of real named parameter support, and makes it even less
> likely that we'll actually get to the end. Python has it good - every
> argument can be given either by position or by name, and you can
> collect both extra positional arguments and extra named arguments.
> I'd prefer figuring out a syntax for argument lists that gives us the
> same argument-list power as Python.
>
Adding Python'ic way of handling parameters requires
substantial change of existing runtime architecture ('arguments' and around).
In contrary proposed
foo {one:1,two:2 };
requires just syntax change .
--
Andrew Fedoniouk.
http://terrainformatica.com
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss