(x) => {foo: bar}

Gary Guo nbdd0121 at hotmail.com
Tue Jan 6 03:34:27 PST 2015

Nope. {a:1;} will work in REPL of Node.js. In source code of repl.js, it will wrap input with parentheses first, and if there is a syntax error, it then evaluate the code without parentheses. You can test {a:1} and {a:1;}, both of them works; the former one returns {a:1} while the latter one returns 1.

From: alex at kocharin.ru
To: nbdd0121 at hotmail.com; brendan at mozilla.org
CC: es-discuss at mozilla.org
Subject: Re: (x) => {foo: bar}
Date: Tue, 6 Jan 2015 06:59:52 +0300

 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.  		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150106/38c5f5bb/attachment.html>

More information about the es-discuss mailing list