On Tue, Oct 14, 2014 at 11:42 AM, Axel Rauschmayer <[email protected]> wrote:
> Are we OK with this? Seems like removing `entries`, `keys` and providing > own default `@@iterator` for `Set` which should be just `values()` would > make it more sense from the abstraction usage perspective. > > > W.r.t. your last suggestion: that’s how the spec does it. Anything else > would definitely not have made sense. > > > https://people.mozilla.org/~jorendorff/es6-draft.html#sec-set.prototype-@@iterator > > So you're saying that `for-of` iterates only `values`, but `forEach` values and "keys" (again values)? ``` var aSet = new Set([1, 2, 3]); for (var v in aSet) { console.log(v); // 1, 2, 3 } ``` But ``` aSet.forEach((v, v1, theSet) => { ... }); ``` Which is basically the same as: ``` for (var [v, v1] in aSet.entries()) { console.log(v, v1); // 1,1 2,2 3,3 } ``` That's said, if we remove the `entries` and `keys`, then the `v1` naturally should (?) go away from the callback parameters as well, and in this case we cannot reuse the callback functions from `Map`s or `Array`s. Dmitry
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

