Optional Curly Braces in JavaScript

Jordan Harband ljharb at gmail.com
Sun Nov 3 01:23:31 UTC 2019

I don’t think the obstacle to JavaScript becoming more widespread is
mandatory curly braces, nor do i think any part of python’s popularity is
due to optional curly braces.

Separately, how are you measuring “widespread”? One measurement might be,
for example, “how many computers is it used on”, and web browsers dwarf
most everything else :-)

On Sat, Nov 2, 2019 at 6:02 PM Ed Saleh <medozs at outlook.com> wrote:

> Hi Kai Zhu,
> We can enforce curly braces through "good practice" JavaScript
> documentation style and eslint style. Making braceless JavaScript feature
> doesn't make it the best style to use, it just give more flexibility. And
> yes Jordan, it should actually be enforced to use curly braces in actual
> coding and that's what I do personally. All I want I want is to see
> JavaScript as wide spread as Python is. I know the reason why Python is
> famous today is for this specific reason, as it's easy to write for all
> types of people.
> Thank you all,
> ------------------------------
> *From:* es-discuss <es-discuss-bounces at mozilla.org> on behalf of kai zhu <
> kaizhu256 at gmail.com>
> *Sent:* Saturday, November 2, 2019 8:06:50 PM
> *To:* Jordan Harband <ljharb at gmail.com>
> *Cc:* Bergi <a.d.bergi at web.de>; es-discuss <es-discuss at mozilla.org>
> *Subject:* Re: Optional Curly Braces in JavaScript
> unlike python, many [client-side] javascript programs require
> rollup/minification into a single dist-file.  removing curly braces (just
> like asi) makes that task more difficult.
> this is also why esm-import-statements were a terrible idea. ppl like me
> would argue frontend-programs (which are mostly non-reusable anyways)
> should be written as single dist-files from the start rather than as
> modules -- and why python-programmers make terrible [frontend/ux]
> javascript-programmers in general.
> On Sun, Nov 3, 2019, 04:48 Jordan Harband <ljharb at gmail.com> wrote:
> My preference would be to make them required in the places they're
> currently optional :-)
> Optional curly braces have led to many bugs, not just in JS (the "goto
> fail" SSL bug, for example) - why is this risk worth making it easier to
> write code on a whiteboard, where it doesn't need to be valid anyways?
> On Sat, Nov 2, 2019 at 12:39 PM Bergi <a.d.bergi at web.de> wrote:
> Hello Ed!
> > That would make JavaScript an easy to write on board language, where a
> language like python dominates because of it's simplicity in writing. This
> would make JavaScript spread into more areas in science, education and
> engineering.
> You seem to not only want to make block syntax optional, but rather make
> whitespace indentation significant. You might want to have a look at
> CoffeeScript <http://coffeescript.org/#language> which is a
> compile-to-JS language that uses this concept. Its function syntax is a
> bit different from what you imagined though, most importantly it doesn't
> offer any declarations.
> kind regards,
>  Bergi
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
> _______________________________________________
> 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/20191102/577ec0d0/attachment-0001.html>

More information about the es-discuss mailing list