Set Objects

Peter Michaux petermichaux at
Wed Apr 3 21:17:57 PDT 2013

On Fri, Mar 29, 2013 at 5:04 PM, Allen Wirfs-Brock
<allen at> wrote:
> On Mar 29, 2013, at 3:02 PM, Peter Michaux wrote:

>> Why will callbackfn be called with the first two parameters being the
>> same? That does not seem like the most practical or intuitive behavior
>> for a set.
> The intent is that all forEach methods use the same callback signature.
> This is explained in the second note.
>> The third NOTE about visiting elements that are deleted or added
>> during iteration is excellent. Browsers have certainly varied in their
>> behavior.
> Yes, but this is just a note.  The specification algorithm normatively
> exhibit this behavior which is where it really counts.

In that case, I think the second note might be an error. The
specification algorithm has the following

8.a.i) Let funcResult be the result of calling the [[Call]] internal
method of callbackfn with T as thisArgument and a List containing e
and S as argumentsList.

That means the callback function is called with only two arguments not
three as mentioned in the second note.


More information about the es-discuss mailing list