Did you read the proposal?
http://wiki.ecmascript.org/doku.php?id=strawman:paren_free
Yes, it means if you start a condition with '(' you are obligated to use
paren-full not paren-free style. :-P
/be
On Mon, Feb 1, 2016 at 10:20 AM Andreas Rossberg
wrote:
> This
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@mozilla.org
Braces required, see the old strawman.
/be
On Mon, Feb 1, 2016 at 9:18 AM Andreas Rossberg wrote:
> 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
I've noticed that there's a strawman that has been left untouched for quite a
while, namely
[strawman:paren_free](http://wiki.ecmascript.org/doku.php?id=strawman:paren_free).
It intends to make parentheses in heads optional, making, for instance:
```js
if x > 3 {
/* … */
}
```
equivalent
I've noticed that there's a strawman that has been left untouched for quite a
while, namely
[strawman:paren_free](http://wiki.ecmascript.org/doku.php?id=strawman:paren_free).
It intends to make parentheses in heads optional, making, for instance:
```js
if x > 3 {
/* … */
}
```
equivalent
I love the paren-free head idea. But as an obsessive user of non-braced
single-statement if/for/while bodies, I don't see the advantage of making
the head paren-free at the cost of mandating braces for the body.
Has either of the following been considered:
```js
if i < 3: foo();
if i < 3 do
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
This refactoring hazard is intimately tied to the infinite look-ahead
problem. Teaching a parser to handle the latter case or examples like `if
(x) (y) -z {}` correctly is gonna be all but easy. Either backtracking or
terrifying grammar refactorings would be needed.
On 1 February 2016 at 18:46,
On Mon, Feb 1, 2016 at 8:02 AM kdex wrote:
> [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.
>
>
The strawman exists
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 wrote:
> Well, try and define "natural" in the context of constructed languages.
>
> If this was a
10 matches
Mail list logo