ES4 draft: Map

Lars Hansen lhansen at
Fri Feb 29 15:19:42 PST 2008

> -----Original Message-----
> From: Erik Arvidsson [mailto:erik.arvidsson at] 
> Sent: 29. februar 2008 19:17
> To: Lars Hansen
> Cc: es4-discuss at
> Subject: Re: ES4 draft: Map
> Hi Lars,
> To me it seems like iterator::get* will not return lazy 
> iterators.  Is that intentional?  I think it defeats one of 
> the benefits of using iterators over arrays.
> Anyway, if it is intentional, I think it should be documented 
> (outside the actual code).

The code that is there is intentionally written so, but it does
not preclude using lazy iterators.  What the code specifies (and
what I would welcome debate on) is that insertions into and
deletions from the Map after the iterator has been obtained are
not visible during iteration.  A good implementation would
delay creating any intermediate data structure to hold the values
yet to be returned until changes to the map makes that required.
But it wouldn't be appropriate for the spec to include that

The requirement for helper::iterate in this regard is that it must 
not be observable (apart from time and space, perhaps) whether it
creates intermediate data structures or not, and if it does, when
it does it.  (This is analogous to how the Reference data type is
treated in the ES3 spec -- most implementations don't use it, even
though it's all over the spec.)


More information about the Es4-discuss mailing list