Re: Syntax sugar for partial application

2015-04-09 Thread Jussi Kalliokoski
On Thu, Apr 9, 2015 at 4:04 PM, liorean lior...@gmail.com 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.

Re: loop unrolling and completion values in ES6

2015-04-09 Thread Alan Schmitt
On 2015-04-08 16:59, Allen Wirfs-Brock al...@wirfs-brock.com 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

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 alan.schm...@polytechnique.org 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

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

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 kos...@gmail.com wrote: ( note: you can view this message as a gist @ https://gist.github.com/kosich/375da99403c76bc75bbd https://gist.github.com/kosich/375da99403c76bc75bbd )

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 ljh...@gmail.com 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

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 a...@rauschma.de wrote: Proxies should be enough for

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

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 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: 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 lior...@gmail.com wrote: Do we really need it? Your «foo(1, ?, 2);» is equivalent to «a=foo(1,a,2)». Your «foo(?,

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