Another paren-free gotcha
Peter van der Zee
ecma at qfox.nl
Thu Sep 29 01:06:22 PDT 2011
On Thu, Sep 29, 2011 at 3:43 AM, Quildreen Motta <quildreen at gmail.com> wrote:
> I'm not sure how this is much different from the rules you have now with
> ASI, though if this were such a problem, a block statement could be required
I'm trying to make sure we don't add another feature that we'll later
describe as "yeah, wish we could take that out, but we can't, that
ship has sailed". This ship hasn't sailed yet and if it does, I'd like
it to be as clean as possible.
On Thu, Sep 29, 2011 at 3:01 AM, Brendan Eich <brendan at mozilla.com> wrote:
> If ASI is the culprit to focus on, I can work harder on ASI in relation to paren-free. I do not want to hack on paren-free by itself. It's quite simple and not in need of "patching".
> My approach would be to make newlines *more* significant, not less.
What you could do here is require paren-less headers to be single
lined, on the same line as the `if` keyword, and require a newline
between the paren-less header and the body. Such newline would signify
the end of the statement header, much like ASI ("API"? ;). And if you
want to use a block, you may put the first curly of the block on the
same line as the paren-less header (or next line if you prefer K&R
anyways). I'm not so sure if that would fix any of the raised
objections though. You'd also be introducing more restrictions in the
grammar (afaik you weren't very fond of these) and introduce another
ASI-like scheme into the language.
I worry a bit about legibility (but have nothing to back that up with).
More information about the es-discuss