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. IMO, #a was necessary to convince me. YAGNI. Given #a, #b was sufficient. Dave, if I've misrepresented you in any way, please correct. Thanks. On Wed, Apr 15, 2015 at 10:20 AM, Axel Rauschmayer <[email protected]> wrote: > 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 18:34, Tab Atkins Jr. <[email protected]> wrote: > > On Wed, Apr 15, 2015 at 9:31 AM, Jeremy Martin <[email protected]> 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 insert two > or more elements into the result in a single iteration. > > ~TJ > _______________________________________________ > es-discuss mailing list > [email protected] > https://mail.mozilla.org/listinfo/es-discuss > > > -- > Dr. Axel Rauschmayer > [email protected] > rauschma.de > > > > > _______________________________________________ > es-discuss mailing list > [email protected] > https://mail.mozilla.org/listinfo/es-discuss > > -- Cheers, --MarkM
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

