Re: Set.prototype.entries: indices as keys?

2015-01-19 Thread Brendan Eich
Dmitry Soshnikov wrote: ```js let [x,y] = set; // x='a'; y='b’; ``` Would this work actually? :) Destructuring does get property, which wouldn't call set's `get` method. See

Re: Set.prototype.entries: indices as keys?

2015-01-19 Thread Axel Rauschmayer
Sets are not a linear data structure, so the order of entries in a Set is irrelevant, unlike an Array whose elements must have an explicit position. Set entries in JS have an iteration order purely to match programmer intuition (and ensure that all implementations adhere), however there is

Set.prototype.entries: indices as keys?

2015-01-18 Thread Axel Rauschmayer
Currently the keys of the entries returned by `Set.prototype.entries()` are the same as the values: ```js let set = new Set(['a', 'b']); let pairs = [...set.entries()]; console.log(JSON.stringify(pairs)); // [[a,a],[b,b”]] ``` Given that sets are ordered, I’d use the “position” of an entry as

Re: Set.prototype.entries: indices as keys?

2015-01-18 Thread Mark Volkmann
+1 --- R. Mark Volkmann Object Computing, Inc. On Jan 18, 2015, at 6:28 AM, Axel Rauschmayer a...@rauschma.de wrote: Currently the keys of the entries returned by `Set.prototype.entries()` are the same as the values: ```js let set = new Set(['a', 'b']); let pairs =