Re: Array comprehensions with Spread operator

2015-04-15 Thread Jeremy Martin
Thanks, I gathered so after your response. This is why 99% of the time I wait for at least one other person to reply first, and why I *should* wait the remaining 1%... :) On Wed, Apr 15, 2015 at 12:34 PM, Tab Atkins Jr. jackalm...@gmail.com wrote: On Wed, Apr 15, 2015 at 9:31 AM, Jeremy Martin

Re: Array comprehensions with Spread operator

2015-04-15 Thread Tab Atkins Jr.
On Wed, Apr 15, 2015 at 9:23 AM, monolithed monolit...@gmail.com wrote: ```js let x = [0, 1, 2]; let y = [3, 4, 5]; // Expected [ for (i of [x, y]) ...i ]; // Reality Array.prototype.concat(...[ for (x of [x, y]) i ]); // Result [0, 1, 2, 3, 4, 5] ``` Is there any discussion on

Re: Array comprehensions with Spread operator

2015-04-15 Thread Jeremy Martin
Why not just `[...x, ...y]`? On Wed, Apr 15, 2015 at 12:23 PM, monolithed monolit...@gmail.com wrote: ```js let x = [0, 1, 2]; let y = [3, 4, 5]; // Expected [ for (i of [x, y]) ...i ]; // Reality Array.prototype.concat(...[ for (x of [x, y]) i ]); // Result [0, 1, 2, 3, 4, 5]

Re: Array comprehensions with Spread operator

2015-04-15 Thread Tab Atkins Jr.
On Wed, Apr 15, 2015 at 9:31 AM, Jeremy Martin jmar...@gmail.com wrote: Why not just `[...x, ...y]`? Obviously that's a solution to the trivial example that monolithed provided, but it's not a solution to the more general problem he's alluding to, where you're doing a comprehension and want to

Array comprehensions with Spread operator

2015-04-15 Thread monolithed
```js let x = [0, 1, 2]; let y = [3, 4, 5]; // Expected [ for (i of [x, y]) ...i ]; // Reality Array.prototype.concat(...[ for (x of [x, y]) i ]); // Result [0, 1, 2, 3, 4, 5] ``` Is there any discussion on this subject? ___ es-discuss mailing

Re: Re: ModuleSpecifier: include .js or not?

2015-04-15 Thread monolithed
This question has already been asked https://mail.mozilla.org/pipermail/es-discuss/2015-February/041430.html I prefer to follow the following rules: File structure ``` root/ foo/ index.js ``` Export module ```js export default foo class () {} ``` Import module

Re: Array comprehensions with Spread operator

2015-04-15 Thread Axel Rauschmayer
It’s important to keep in mind that there is no official version of array comprehensions, at the moment. So that is something to keep in mind whenever they are added to the language. I’d probably implement flatMap() and use it if I ever needed to do something like this. On 15 Apr 2015, at

Re: Array comprehensions with Spread operator

2015-04-15 Thread Axel Rauschmayer
Right, `map()` et al. plus arrow functions come pretty close to the syntactic elegance of comprehensions. On 15 Apr 2015, at 20:27, Mark S. Miller erig...@google.com wrote: Dave Herman did an excellent presentation at one of the TC39 meetings that convinced us all to drop comprehension

Re: Array comprehensions with Spread operator

2015-04-15 Thread Mark S. Miller
Dave Herman did an excellent presentation at one of the TC39 meetings that convinced us all to drop comprehension syntax from ES6. I remember it surprised us all including, earlier Dave, which led to his presentation. Anyone have a link? The arguments that I remember as most significant are a)

Re: Array comprehensions with Spread operator

2015-04-15 Thread liorean
On 15 April 2015 at 18:36, Jeremy Martin jmar...@gmail.com wrote: Thanks, I gathered so after your response. This is why 99% of the time I wait for at least one other person to reply first, and why I should wait the remaining 1%... :) Heck no! You asking that question clarified the problem

Re: Array comprehensions with Spread operator

2015-04-15 Thread Rick Waldron
On Wed, Apr 15, 2015 at 2:27 PM Mark S. Miller erig...@google.com wrote: Dave Herman did an excellent presentation at one of the TC39 meetings that convinced us all to drop comprehension syntax from ES6. I remember it surprised us all including, earlier Dave, which led to his presentation.

Re: Array comprehensions with Spread operator

2015-04-15 Thread monolithed
@ liorean, For the record, what I can see, the code in the example is broken in another way as well, the «i» in the reality example is not the variable name used in the for-of. You're right the second example is broken. I can not edit my messages, sorry. ```js Array.prototype.concat(...[ for

Re: Array comprehensions with Spread operator

2015-04-15 Thread Mark S. Miller
On Wed, Apr 15, 2015 at 1:11 PM, monolithed monolit...@gmail.com wrote: @Mark S. Miller, Dave Herman did an excellent presentation at one of the TC39 meetings that convinced us all to drop comprehension syntax from ES6. I remember it surprised us all including, earlier Dave, which led to

Could we make %ArrayPrototype%'s [[DefineOwnProperty]] throw or no-op for numeric keys?

2015-04-15 Thread Domenic Denicola
Just an idle thought: Many of the spec-compliance bugs in engines' array implementations over the last couple years have had to do with handling what happens when you e.g. install getters or setters on %ArrayPrototype%. I've been told that handling this case adds lots of complexity to the

Re: Nailing object property order

2015-04-15 Thread Tab Atkins Jr.
On Wed, Apr 15, 2015 at 6:39 PM, a.d.be...@web.de wrote: Hello! Why does ES6 specify the order of keys in objects, maps and sets? Specifically section 9.1.12 [[OwnPropertyKeys]] says the result list must be integer indices in ascending numeric, then strings in property creation order, then

Nailing object property order

2015-04-15 Thread a . d . bergi
Hello! Why does ES6 specify the order of keys in objects, maps and sets? Specifically section 9.1.12 [[OwnPropertyKeys]] says the result list must be integer indices in ascending numeric, then strings in property creation order, then symbols in property creation order. Similarly, 23.1.3.5

Re: Nailing object property order

2015-04-15 Thread Jordan Harband
For what it's worth, forcing an enumeration order does make polyfilling harder, assuming there's an engine out there that *doesn't* already use that ordering. On Wed, Apr 15, 2015 at 6:39 PM, a.d.be...@web.de wrote: Hello! Why does ES6 specify the order of keys in objects, maps and sets?

Re: Nailing object property order

2015-04-15 Thread Bergi
Tab Atkins Jr. schrieb: On Wed, Apr 15, 2015 at 6:39 PM, a.d.be...@web.de wrote: What was the motivation to pin these down in ES6? Because, for objects at least, all implementations used approximately the same order (matching the current spec), and lots of code was inadvertently written