(x) => {foo: bar}

Isiah Meadows impinball at gmail.com
Tue Jan 6 13:53:04 PST 2015


Okay: is this a valid statement/expression? I didn't think so, but I may be
wrong.

```js
({ foo(); bar(); })
```
On Jan 6, 2015 11:16 AM, "Rick Waldron" <waldron.rick at gmail.com> wrote:

>
>
> On Tue Jan 06 2015 at 2:18:47 AM Isiah Meadows <impinball at gmail.com>
> wrote:
>
>> > From: Alex Kocharin <alex at kocharin.ru>
>> > To: Gary Guo <nbdd0121 at hotmail.com>, "brendan at mozilla.org" <
>> brendan at mozilla.org>
>> > Cc: "es-discuss at mozilla.org" <es-discuss at mozilla.org>
>> > Date: Tue, 06 Jan 2015 06:59:52 +0300
>> > Subject: Re: (x) => {foo: bar}
>> >
>> > 06.01.2015, 06:38, "Gary Guo" <nbdd0121 at hotmail.com>:
>> >
>> >
>> > Though I am strongly negative, but there actually is such an
>> implementation. The REPL of node will parse {a:1} as object literal while
>> {a:1;} as block.
>> >
>> >
>> > Node.js REPL wraps all the statements in parentheses. Therefore
>> `{a:1;}` becomes `({a:1;})` which is a syntax error.
>> >
>>
>> Not in my REPL (node 0.10.33).
>>
>> ```
>> $ node
>> > {a:1;}
>> 1
>> > {a:1}
>> { a: 1 }
>> ```
>>
>> What the Node.js REPL effectively appears to do, AFAICT, is some sort
>> of evented try-catch.
>
>
> No, that's not what it does. Alex was close, but not exactly right. The
> REPL will test input and wrap if necessary:
> https://github.com/joyent/node/blob/master/lib/repl.js#L266-L271
>
> Rick
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150106/8fd19e18/attachment.html>


More information about the es-discuss mailing list