<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>26973</bug_id>
          
          <creation_ts>2014-10-05 00:57:58 +0000</creation_ts>
          <short_desc>make iterable declarations&apos; iterator prototype objects inherit from %IteratorPrototype%</short_desc>
          <delta_ts>2016-09-08 21:12:08 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebAppsWG</product>
          <component>WebIDL</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Cameron McCormack">cam</reporter>
          <assigned_to name="Cameron McCormack">cam</assigned_to>
          <cc>allen</cc>
    
    <cc>brendan</cc>
    
    <cc>bzbarsky</cc>
    
    <cc>d</cc>
    
    <cc>dherman</cc>
    
    <cc>mike</cc>
    
    <cc>public-script-coord</cc>
          
          <qa_contact>public-webapps-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>112703</commentid>
    <comment_count>0</comment_count>
    <who name="Cameron McCormack">cam</who>
    <bug_when>2014-10-05 00:57:58 +0000</bug_when>
    <thetext>http://heycam.github.io/webidl/#es-iterator-prototype-object

[[
The internal [[Prototype]] property of an iterator prototype object MUST be the Object.prototype object. 
]]

http://lists.w3.org/Archives/Public/public-script-coord/2014OctDec/0058.html points out that iterator objects in ES6 all inhert from %IteratorPrototype%, so we should do the same with iterator prototype objects generated for iterable declarations.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>112704</commentid>
    <comment_count>1</comment_count>
    <who name="Brendan Eich">brendan</who>
    <bug_when>2014-10-05 02:43:26 +0000</bug_when>
    <thetext>The plan is to put much-wanted methods on Iterator.prototype, in ES7. The iteration protocol in JS is still structural, but Iterator() provides an adapter from structural to nominal, with map/filter/etc. handy methods via prototypal inheritance.

Dave should correct me on anything amiss here. I hope this helps improve the web platform sooner.

/be</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>112707</commentid>
    <comment_count>2</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2014-10-05 03:30:18 +0000</bug_when>
    <thetext>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!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>112711</commentid>
    <comment_count>3</comment_count>
    <who name="Brendan Eich">brendan</who>
    <bug_when>2014-10-05 05:03:33 +0000</bug_when>
    <thetext>(In reply to Boris Zbarsky from comment #2)
&gt; Yeah, having generic map/filter that apply to any iterable and live on
&gt; Iterator.prototype (and perhaps some prototypes of other iterables like Set
&gt; 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&apos;s &apos;of&apos; and @@iterator does the rest.

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

/be</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>112712</commentid>
    <comment_count>4</comment_count>
    <who name="Cameron McCormack">cam</who>
    <bug_when>2014-10-05 05:16:51 +0000</bug_when>
    <thetext>This would mean that you would write things like:

  myMap.keys().filter((x) =&gt; x &gt; 10)

yeah?  To make it a little easier to type than:

  [...myMap.keys()].filter((x) =&gt; x &gt; 10)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>112720</commentid>
    <comment_count>5</comment_count>
    <who name="Brendan Eich">brendan</who>
    <bug_when>2014-10-05 16:21:14 +0000</bug_when>
    <thetext>(In reply to Cameron McCormack from comment #4)
&gt; This would mean that you would write things like:
&gt; 
&gt;   myMap.keys().filter((x) =&gt; x &gt; 10)
&gt; 
&gt; yeah?  To make it a little easier to type than:
&gt; 
&gt;   [...myMap.keys()].filter((x) =&gt; x &gt; 10)

Yes, and more efficient too.

(BTW the single-parameter arrow function form does not need parens around the formal parameter: x =&gt; x &gt; 10 -- just passing this along in case it needs some publicity. ;-)

/be</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>127350</commentid>
    <comment_count>6</comment_count>
    <who name="Domenic Denicola">d</who>
    <bug_when>2016-09-08 21:12:08 +0000</bug_when>
    <thetext>This appears to have been fixed a while ago.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>