plus any time you want you can `GenericPrototype.toArray =
function(){return Array.from(this)};` ... no need to put in specs your C#
flavor, somebody else Python flavor, Ruby, Java, or Haskell ... JS would
look like the tower of babel ^_^note: it kinda does already in specs V6 and early 7 On Thu, Aug 29, 2013 at 9:01 AM, Forbes Lindesay <[email protected]>wrote: > This all seems fair enough. My concern is mostly that the > `blob.method(fn)` syntax seems much easier to get your head around (as > someone familiar to JavaScript) than the `[for (let x of iter) if (pred(x) > transf(x)]`. I always used the traditional syntax for LINQ in C# as well > (which gave you both options). Perhaps I'm just too set in my ways though. > I'm happy to accept that it's probably easy enough to just rely on > `Array.from` when you want an array from an iterator. > > -----Original Message----- > From: Andreas Rossberg [mailto:[email protected]] > Sent: 29 August 2013 09:56 > To: Forbes Lindesay > Cc: [email protected] > Subject: Re: `.toArray()` for all generators > > On 28 August 2013 17:02, Forbes Lindesay <[email protected]> wrote: > > It would be nice from a readability point of view if > > `iteratable.toArray()` could always be used as a substitute for > > `Array.from(iteratable)`. Is there a way that could be neatly > > achieved? It would also be nice if methods like `.map` and `.filter` > > existed on iteratables. C# does this via the concept of extension > > methods, but I wonder whether something similar could be achieved here, > at least in the case of built in iteratables? > > In addition to what others have already said, note that iterators model > streams that are not necessarily finite. Hence, a toArray method would not > generally be well-defined. > > /Andreas > _______________________________________________ > es-discuss mailing list > [email protected] > https://mail.mozilla.org/listinfo/es-discuss >
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

