> From: Alex Kocharin <[email protected]>
> To: Gary Guo <[email protected]>, "[email protected]" 
> <[email protected]>
> Cc: "[email protected]" <[email protected]>
> Date: Tue, 06 Jan 2015 06:59:52 +0300
> Subject: Re: (x) => {foo: bar}
>
> 06.01.2015, 06:38, "Gary Guo" <[email protected]>:
>
>
> 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. Though, @Gary, I agree 100% with what you said
about being very against it. It would require a lot more context to
figure out if something returns an object, as `{a, b, c}` is
technically both a valid block and object (using shorthand
properties). The problems would then become non-obvious and difficult
to diagnose in practice.

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

Reply via email to