W3C home > Mailing lists > Public > public-script-coord@w3.org > October to December 2014

[Bug 26973] make iterable declarations' iterator prototype objects inherit from %IteratorPrototype%

From: <bugzilla@jessica.w3.org>
Date: Sun, 05 Oct 2014 05:03:33 +0000
To: public-script-coord@w3.org
Message-ID: <bug-26973-3890-AN1HnoOwes@http.www.w3.org/Bugs/Public/>
https://www.w3.org/Bugs/Public/show_bug.cgi?id=26973

--- Comment #3 from Brendan Eich <brendan@mozilla.org> ---
(In reply to Boris Zbarsky from comment #2)
> Yeah, having generic map/filter that apply to any iterable and live on
> Iterator.prototype (and perhaps some prototypes of other iterables like Set
> and Map) would be really nice!

Iterator not iterable, so if Map and Set have standard iterators that delegate
to Iterator.prototype, then everything works automagically. You name a map or
set on the right of for-of's 'of' and @@iterator does the rest.

Having Map.prototype.map do the @@iterator call and delegate to the returned
iterator's map is doable but seems unnecessary when using for-of. When calling
someMap.filter directly, of course, it's wanted. Some design freedom here to
"do both", IMHO.

/be

-- 
You are receiving this mail because:
You are on the CC list for the bug.
Received on Sunday, 5 October 2014 05:03:36 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:14:23 UTC