Paren-free heads strawman

Andreas Rossberg rossberg at google.com
Mon Feb 1 17:17:49 UTC 2016


Will

  if x (y) (z);

parse as

  if (x) ((y)(z));

or

  if (x(y)) (z);

? And how do you parse it without infinite look-ahead?

/Andreas


On 1 February 2016 at 17:01, kdex <kdex at kdex.de> wrote:

> Well, try and define "natural" in the context of constructed languages.
>
> If this was a question of "naturalness" (whatever that may be), then
> really any deviation from what the language currently is, is "unnatural".
>
> Anyway, we're here to discuss, not to blindly judge. :)
>
>
>
> Note that the parens serve no purpose whatsoever.
>
> They're actually just a relic dating back to Ken Thompson's
> re-interpretation of BCPL, B (1969), which in turn did this, because in
> FORTRAN,
>
> `if x` and `ifx` looked the same to the parser; the parens were thus
> needed for the parser to differentiate between the two.
>
>
>
> Since C derived from B, virtually any language that derived from it
> adapted to this redundant syntax; nowadays, the parens exist solely for
> decoration.
>
>
>
> [Douglas Crockford](https://www.youtube.com/watch?v=Nlqv6NtBXcA) and
> [Brendan Eich](https://brendaneich.com/2010/11/paren-free/) seem
>
> to be in favor of making them optional; that's why the strawman exists.
>
>
>
> On Montag, 1. Februar 2016 15:47:52 CET Alican Çubukçuoğlu wrote:
>
> > Isn't this very unnatural? If you are into this kind of thing, why don't
>
> > you code Coffee for example? (Or don't since saving a few keystrokes
> isn't
>
> > worth your dignity.)
>
> >
>
> _______________________________________________
> 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/20160201/2b7f16d7/attachment.html>


More information about the es-discuss mailing list