Re: Well-Known Symbols: Array item getter/setter

2015-04-09 Thread Axel Rauschmayer
An alternative that was discussed at one point was to invert this idea: * Arrays get the methods that Maps already have: `get(index)` and `set(index, value)`. Advantage: one could support negative indices. That is, the following two expressions would be equivalent. ```js arr.get(-1)

Re: Well-Known Symbols: Array item getter/setter

2015-04-09 Thread Allen Wirfs-Brock
> On Apr 9, 2015, at 2:37 PM, Jordan Harband wrote: > > One advantage of this approach is that more "spec magic" can be implemented > in terms of the language - it would also make subclassed arrays more > versatile instead of having to always be a Proxy. see http://wiki.ecmascript.org/doku.ph

Re: Well-Known Symbols: Array item getter/setter

2015-04-09 Thread Kos Ddsky
1. one will have to provide access to all `Array.prototype.methods` 2. proxies will be slower 3. bad readability ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: Well-Known Symbols: Array item getter/setter

2015-04-09 Thread Jordan Harband
One advantage of this approach is that more "spec magic" can be implemented in terms of the language - it would also make subclassed arrays more versatile instead of having to always be a Proxy. On Thu, Apr 9, 2015 at 11:35 AM, Axel Rauschmayer wrote: > Proxies should be enough for this. Is ther

Re: Well-Known Symbols: Array item getter/setter

2015-04-09 Thread Axel Rauschmayer
Proxies should be enough for this. Is there any reason not to use them? > On 09 Apr 2015, at 20:31, Kos Ddsky wrote: > > ( note: you can view this message as a gist @ > https://gist.github.com/kosich/375da99403c76bc75bbd > ) > Currently we

Well-Known Symbols: Array item getter/setter

2015-04-09 Thread Kos Ddsky
( note: you can view this message as a gist @ https://gist.github.com/kosich/375da99403c76bc75bbd ) Currently we can imitate Arrays only with objects, where we would refer to a value at some position via referring to objects property ( with integer index being converted to a string ) ```js var ar

Re: loop unrolling and completion values in ES6

2015-04-09 Thread Brendan Eich
Alan Schmitt wrote: We found this by looking into loop unrolling, so it would be great if completion values could propagate across loop iterations. Definitely. Thanks for finding this! /be ___ es-discuss mailing list es-discuss@mozilla.org https://ma

Re: loop unrolling and completion values in ES6

2015-04-09 Thread Allen Wirfs-Brock
> On Apr 9, 2015, at 10:44 AM, Alan Schmitt > wrote: > > 1. Let sl be the result of evaluating StatementList. > 2. ReturnIfAbrupt(sl). > 3. Let s be the result of evaluating StatementListItem. > 4. If s.[[type]] is throw, return Completion(s). > 5. If s.[[value]] is empty, let V = sl.[[value]],

Re: loop unrolling and completion values in ES6

2015-04-09 Thread Alan Schmitt
On 2015-04-08 16:59, Allen Wirfs-Brock writes: > Well, they do for normal loop completions (according to the spec.) but not for > breaks. I this the latter is a bug. In particular, I think it is pretty > obvious that: >eval(“ {0; while (true) {1; break}; 2}”) > should evaluate to 1 > > It is

Re: Syntax sugar for partial application

2015-04-09 Thread Jussi Kalliokoski
On Thu, Apr 9, 2015 at 4:04 PM, liorean wrote: > Do we really need it? > Your «foo(1, ?, 2);» is equivalent to «a=>foo(1,a,2)». > Your «foo(?, 1, ???);» is equivalent to «(a,...b)=>foo(a,1,...b)». > Your «foo(1, ???, 2);» is equivalent to «(...a)=>foo(...[1,...a,2])». > Not exactly. Using the pl

Re: Syntax sugar for partial application

2015-04-09 Thread Andrea Giammarchi
FWIW: agreed with others, it looks a pretty pointless sugar. It doesn't seem to bring anything new or "that needed" to the language. -1 here On Thu, Apr 9, 2015 at 2:04 PM, liorean wrote: > Do we really need it? > Your «foo(1, ?, 2);» is equivalent to «a=>foo(1,a,2)». > Your «foo(?, 1, ???);» i

Re: Syntax sugar for partial application

2015-04-09 Thread liorean
Do we really need it? Your «foo(1, ?, 2);» is equivalent to «a=>foo(1,a,2)». Your «foo(?, 1, ???);» is equivalent to «(a,...b)=>foo(a,1,...b)». Your «foo(1, ???, 2);» is equivalent to «(...a)=>foo(...[1,...a,2])». Also, the ? token is already taken by the ternary conditional operator. Do we really

Re: Syntax sugar for partial application

2015-04-09 Thread Nick Krempel
On 9 April 2015 at 08:46, Jussi Kalliokoski wrote: > Yesterday I came up with an idea for syntactic sugar for partial > application, introducing two new operators: placeholder (`?`) and rest > placeholder (`???`). > While this looks nice, I'm not sure it's worth new syntax as it can be adequate

Re: Syntax sugar for partial application

2015-04-09 Thread Salvador de la Puente González
I like it but I think I would prefer to make it explicit. Something like: foo = foo.partial(1, ?, 2, ???, 3) Extending it to bind when I want to do something like: obj.foo = foo.bind(obj, 1, ?, 2, ???, 3) WDYT? On Thu, Apr 9, 2015 at 9:46 AM, Jussi Kalliokoski < jussi.kallioko...@gmail.com> wr

Syntax sugar for partial application

2015-04-09 Thread Jussi Kalliokoski
Yesterday I came up with an idea for syntactic sugar for partial application, introducing two new operators: placeholder (`?`) and rest placeholder (`???`). You can see the details in a proposal gist I made [1], but the gist of the gist is that you could do partial application like this: foo(1, ?