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
A similar proposal was recently brought up - please check out
https://esdiscuss.org/topic/javascript-language-feature-idea to browse the
existing conversation on it.
On Mon, Feb 1, 2016 at 2:35 PM, Lich <6po...@gmail.com> wrote:
> Hi! It would be great if we could use negative indexes, -1 being
Hi! It would be great if we could use negative indexes, -1 being the index
of the last element of an Array or of an Array-like object . Also, an alias
for console.log would be more than welcome.
___
es-discuss mailing list
es-discuss@mozilla.org
`arr.slice(-1)[0]` does what you want, I think.
--scott
___
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss
Yes, that would do what he wants...but I like the idea of using
```arr[-1]```, though!!
It just makes sense, to me!
Specially if you want to use reversed loops, for example.
On Mon, Feb 1, 2016 at 5:46 PM C. Scott Ananian
wrote:
> `arr.slice(-1)[0]` does what you want,
Felipe, this has been discussed in the other thread that was just linked:
https://esdiscuss.org/topic/javascript-language-feature-idea. `arr[-1]` is
not a workable solution because it could break existing code.
On Mon, Feb 1, 2016 at 4:43 PM, Felipe Nascimento de Moura <
felipenmo...@gmail.com>
hm...yep...you are right!
On Mon, Feb 1, 2016 at 10:51 PM Logan Smyth wrote:
> Felipe, this has been discussed in the other thread that was just linked:
> https://esdiscuss.org/topic/javascript-language-feature-idea. `arr[-1]`
> is not a workable solution because it could
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
16 matches
Mail list logo