Set constructor arguments
erik.arvidsson at gmail.com
Sun Feb 12 18:29:28 PST 2012
The default argument should probably just be an iterable.
On Feb 12, 2012 4:50 PM, "Oliver Hunt" <oliver at apple.com> wrote:
> I saw a reference to it being modified to take an array(-like?) as a
> parameter. While I can see an argument in favour of a single array
> argument I can also see using a set of parameters that initially populate
> the set. We just shouldn't allow both (and introduce another version of
> the horror that is the Array constructor).
> With the existence of the spread operator I think that there's a good
> argument in favour of the multiple parameters approach.
> On Feb 12, 2012, at 4:33 PM, Peter Michaux wrote:
> > In the proposal, the Set constructor takes no arguments.
> > http://wiki.ecmascript.org/doku.php?id=harmony:simple_maps_and_sets
> > Could it take a list of initial elements to be included in the set?
> > var s = new Set('alpha', 'beta');
> > s.has('alpha'); // true
> > I think this is a lot better than the verbosity that is
> > var s = new Set();
> > s.add('alpha');
> > s.add('beta');
> > Peter
> > _______________________________________________
> > es-discuss mailing list
> > es-discuss at mozilla.org
> > https://mail.mozilla.org/listinfo/es-discuss
> es-discuss mailing list
> es-discuss at mozilla.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss