monolithed (2015-04-15T20:11:42.000Z)
d at domenic.me (2015-04-19T23:52:51.038Z)
@ 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 (i of [x, y]) i ]); ``` @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) When you look as how much syntactic convenience comprehensions provide above explicit calls to higher-order operations (assuming we have .map, .filter, as well as the currently absent .flatMap) and arrow functions, the answer is not much. b) When your comprehensions involve only those ho operations, fine. But as soon as you try to mix in some other ho operation, such as e.g., a reduce, if you started with a comprehension you're gonna create a mess. OTOH, if you were starting with code explicitly calling ho operations, then there's nothing confusing or unnatural mixing in some others. I can not agree with this approach, [many languages](http://en.wikipedia.org/wiki/List_comprehension) have this functionality For example: ```js var files = function (data) { let result = []; for (let path of data) { result.push(...fs.readdirSync(path)); } return result; } ``` I believe that this code is awkward and not as beautiful as the possible alternatives: ```js var files = function (data) { return [ for (path of data) ...fs.readdirSync(path) ]; } ``` or ```js var files = function (data) { return data.map(path => ...fs.readdirSync(path)); } ```
monolithed at gmail.com (2015-04-15T20:16:25.647Z)
@ 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 (i of [x, y]) i ]); ``` @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) When you look as how much syntactic convenience comprehensions provide above explicit calls to higher-order operations (assuming we have .map, .filter, as well as the currently absent .flatMap) and arrow functions, the answer is not much. b) When your comprehensions involve only those ho operations, fine. But as soon as you try to mix in some other ho operation, such as e.g., a reduce, if you started with a comprehension you're gonna create a mess. OTOH, if you were starting with code explicitly calling ho operations, then there's nothing confusing or unnatural mixing in some others. I can not agree with this approach, [many languages](http://en.wikipedia.org/wiki/List_comprehension) have this functionality For example: ```js var files = function (data) { let result = []; for (let path of data) { result.push(...fs.readdirSync(path)); } return result; } ``` I believe that this code is awkward and not as beautiful as the possible alternatives: ```js var files = function (data) { return [ for (path of data) ...fs.readdirSync(path) ]; } ``` or ```js var files = function (data) { return data.map(path => ...fs.readdirSync(path)); } ``` 2015-04-15 21:27 GMT+03:00 Mark S. Miller <erights at google.com>:
monolithed at gmail.com (2015-04-15T20:16:01.201Z)
@ 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 (i of [x, y]) i ]); ``` @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) When you look as how much syntactic convenience comprehensions provide above explicit calls to higher-order operations (assuming we have .map, .filter, as well as the currently absent .flatMap) and arrow functions, the answer is not much. b) When your comprehensions involve only those ho operations, fine. But as soon as you try to mix in some other ho operation, such as e.g., a reduce, if you started with a comprehension you're gonna create a mess. OTOH, if you were starting with code explicitly calling ho operations, then there's nothing confusing or unnatural mixing in some others. I can not agree with this approach, [many languages]( http://en.wikipedia.org/wiki/List_comprehension) have this functionality For example: ```js var files = function (data) { let result = []; for (let path of data) { result.push(...fs.readdirSync(path)); } return result; } ``` I believe that this code is awkward and not as beautiful as the possible alternatives: ```js var files = function (data) { return [ for (path of data) ...fs.readdirSync(path) ]; } ``` or ```js var files = function (data) { return data.map(path => ...fs.readdirSync(path)); } ``` 2015-04-15 21:27 GMT+03:00 Mark S. Miller <erights at google.com>:
monolithed at gmail.com (2015-04-15T20:14:50.583Z)
@ 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 (i of [x, y]) i ]); ``` @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) When you look as how much syntactic convenience comprehensions provide above explicit calls to higher-order operations (assuming we have .map, .filter, as well as the currently absent .flatMap) and arrow functions, the answer is not much. b) When your comprehensions involve only those ho operations, fine. But as soon as you try to mix in some other ho operation, such as e.g., a reduce, if you started with a comprehension you're gonna create a mess. OTOH, if you were starting with code explicitly calling ho operations, then there's nothing confusing or unnatural mixing in some others. I can not agree with this approach, [many languages]( http://en.wikipedia.org/wiki/List_comprehension) have this functionality For example: ```js var files = function (data) { let result = []; for (let path of data) { result.push(...fs.readdirSync(path)); } return result; } ``` I believe that this code is awkward and not as beautiful as the possible alternatives: ```js var files = function (data) { return [ for (path of data) ...fs.readdirSync(path) ]; } ``` or ```js var files = function (data) { return data.map(path => ...fs.readdirSync(path)); } ``` 2015-04-15 21:27 GMT+03:00 Mark S. Miller <erights at google.com>:
monolithed at gmail.com (2015-04-15T20:14:36.314Z)
@ 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 (i of [x, y]) i ]); ``` @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) When you look as how much syntactic convenience comprehensions provide above explicit calls to higher-order operations (assuming we have .map, .filter, as well as the currently absent .flatMap) and arrow functions, the answer is not much. b) When your comprehensions involve only those ho operations, fine. But as soon as you try to mix in some other ho operation, such as e.g., a reduce, if you started with a comprehension you're gonna create a mess. OTOH, if you were starting with code explicitly calling ho operations, then there's nothing confusing or unnatural mixing in some others. I can not agree with this approach, [many languages]( http://en.wikipedia.org/wiki/List_comprehension) have this functionality For example: ```js var files = function (data) { let result = []; for (let path of data) { result.push(...fs.readdirSync(path)); } return result; } ``` I believe that this code is awkward and not as beautiful as the possible alternatives: ```js var files = function (data) { return [ for (path of data) ...fs.readdirSync(path) ]; } ``` or ```js var files = function (data) { return data.map(path => ...fs.readdirSync(path)); } ``` 2015-04-15 21:27 GMT+03:00 Mark S. Miller <erights at google.com>:
monolithed at gmail.com (2015-04-15T20:14:21.649Z)
@ 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 (i of [x, y]) i ]); ``` @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) When you look as how much syntactic convenience comprehensions provide above explicit calls to higher-order operations (assuming we have .map, .filter, as well as the currently absent .flatMap) and arrow functions, the answer is not much. b) When your comprehensions involve only those ho operations, fine. But as soon as you try to mix in some other ho operation, such as e.g., a reduce, if you started with a comprehension you're gonna create a mess. OTOH, if you were starting with code explicitly calling ho operations, then there's nothing confusing or unnatural mixing in some others. I can not agree with this approach, [many languages]( http://en.wikipedia.org/wiki/List_comprehension) have this functionality For example: ```js var files = function (data) { let result = []; for (let path of data) { result.push(...fs.readdirSync(path)); } return result; } ``` I believe that this code is awkward and not as beautiful as the possible alternatives: ```js var files = function (data) { return [ for (path of data) ...fs.readdirSync(path) ]; } ``` or ```js var files = function (data) { return data.map(path => ...fs.readdirSync(path)); } ``` 2015-04-15 21:27 GMT+03:00 Mark S. Miller <erights at google.com>: