On Sat, Jul 20, 2013 at 6:55 PM, Till Schneidereit <
[email protected]> wrote:

> On Sun, Jul 21, 2013 at 12:44 AM, Rick Waldron <[email protected]>wrote:
>
>>
>>
>>
>> On Sat, Jul 20, 2013 at 6:27 PM, Till Schneidereit <
>> [email protected]> wrote:
>>
>>> On Sun, Jul 21, 2013 at 12:17 AM, Andrew Fedoniouk <
>>> [email protected]> wrote:
>>>
>>>> Unfortunately setters do not work with jQuery where
>>>> chained calls are used frequently:
>>>>
>>>> el.myplugin({....})
>>>>   .addClass("myplugin");
>>>>
>>>> that with new syntax may look like as:
>>>>
>>>> el.myplugin: { params }
>>>>   .addClass: "myplugin";
>>>>
>>>
>>> This is ambiguous. Is `addClass` a method on the `{ params }` object,
>>>
>>
>> No it's not, {}.addClass throws a syntax error exception:
>>
>> {foo:1}.foo; //  SyntaxError at the "."
>>
>> ({foo:1}).foo; // 1
>>
>
> Oh, right, thanks.
>
> @Andrew, is the idea to use this syntax only when passing either object or
> function literals? For those, it wouldn't be ambiguous, indeed.
>

Except that it would be:

  function foo(o) {o}

  foo: { label: 1; }; // 1

This is a labelled statement, followed by a block body (not an object
literal—note the semi-colon inside, following the 1). The block body then
has a labelled statement the contains the identifier "label" and its
statement is the expression statement "1;". The number 1 is returned
because it is the last expression statement in the block's statement list
that returns a value.

Rick
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to