Optional Curly Braces in JavaScript

Ed Saleh medozs at outlook.com
Sun Nov 3 19:51:52 UTC 2019


Any identifier that can implement this feature is great.
________________________________
From: es-discuss <es-discuss-bounces at mozilla.org> on behalf of Ed Saleh <medozs at outlook.com>
Sent: Sunday, November 3, 2019 2:49:35 PM
To: Sanford Whiteman <swhitemanlistens-software at figureone.com>; es-discuss <es-discuss at mozilla.org>
Subject: Re: Optional Curly Braces in JavaScript

If it's not possible to get around that, double underscore `__` or more `_{2,}` can be used.
________________________________
From: es-discuss <es-discuss-bounces at mozilla.org> on behalf of Ed Saleh <medozs at outlook.com>
Sent: Sunday, November 3, 2019 2:47:13 PM
To: Sanford Whiteman <swhitemanlistens-software at figureone.com>; es-discuss <es-discuss at mozilla.org>
Subject: Re: Optional Curly Braces in JavaScript

How is it a valid identifier? I guess the `_` in my case would be used as a statement, not as a function and the JavaScript compiler can somehow distinguish between the different contexts depending on the surrounding identifiers. To my knowledge `_` is used to make numbers more readable, e.g. `1_000_000` rather than `1000000`, but here we have a context of numbers, not expressions or statements.
________________________________
From: es-discuss <es-discuss-bounces at mozilla.org> on behalf of Sanford Whiteman <swhitemanlistens-software at figureone.com>
Sent: Sunday, November 3, 2019 2:41:03 PM
To: es-discuss <es-discuss at mozilla.org>
Subject: Re: Optional Curly Braces in JavaScript

The single character

    _

*is already a valid identifier* as Ron said.

And not an obscure one (not that that would matter) but rather *the
global object used by the Underscore library*.

You might as well be using

    $

here and trying to convince people to stop using it as the top level
of their library.

_______________________________________________
es-discuss mailing list
es-discuss at mozilla.org
https://mail.mozilla.org/listinfo/es-discuss
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20191103/efba5d6e/attachment.html>


More information about the es-discuss mailing list