Re: Set to Array conversions

2013-09-16 Thread Brendan Eich
Claude Pache wrote: Yes, thanks. The wrong placement of parens was a typo. But for the `let` keyword, I just realise that there is a discrepancy between for/of loops and comprehensions. Quite intentionally so -- we do not want the same option to update a loop control variable bound otherwise

Set to Array conversions

2013-09-16 Thread Angus Croll
I'm trying to figure out the most painless way, given a set, to return the set's values as an array. Possibilities: 1) harmony wiki ( http://wiki.ecmascript.org/doku.php?id=harmony:iterators&s=iterator) suggests the following, but it is a syntax error in traceur, continuum and "node --harmony" le

Re: Set to Array conversions

2013-09-16 Thread Rick Waldron
> >> >> On Mon, Sep 16, 2013 at 11:33 AM, Angus Croll wrote: >> >>> I'm trying to figure out the most painless way, given a set, to return >>> the set's values as an array. >>> >> >> >> set.values(); // An array of the set's values >> > > Whoops, that's totally wrong information. (that's what I get

Re: Set to Array conversions

2013-09-16 Thread Rick Waldron
On Mon, Sep 16, 2013 at 11:33 AM, Angus Croll wrote: > I'm trying to figure out the most painless way, given a set, to return the > set's values as an array. > set.values(); // An array of the set's values > > Possibilities: > 1) harmony wiki ( > http://wiki.ecmascript.org/doku.php?id=harmon

Re: Set to Array conversions

2013-09-16 Thread Rick Waldron
On Mon, Sep 16, 2013 at 2:59 PM, Rick Waldron wrote: > > > > On Mon, Sep 16, 2013 at 11:33 AM, Angus Croll wrote: > >> I'm trying to figure out the most painless way, given a set, to return >> the set's values as an array. >> > > > set.values(); // An array of the set's values > Whoops, that's to

Re: Set to Array conversions

2013-09-16 Thread Claude Pache
Le 16 sept. 2013 à 18:38, Brendan Eich a écrit : > Claude, thanks for answering, one correction at bottom: >> Claude Pache >> September 16, 2013 11:42 AM >> I suggest: >> >> [ ... mySet ] >> >> or, if you don't want to use any new syntax: >> >> Array.from(mySet

Re: Set to Array conversions

2013-09-16 Thread Brandon Benvie
On 9/16/2013 9:22 AM, Angus Croll wrote: Thanks - I missed the obvious one I guess - though it still returns an empty array in continuum and traceur. At one point spread was to only work on indexed (array-like) objects. Now it works on both indexed objects as well as iterables. This works in

Re: Set to Array conversions

2013-09-16 Thread Brendan Eich
Claude, thanks for answering, one correction at bottom: Claude Pache September 16, 2013 11:42 AM I suggest: [ ... mySet ] or, if you don't want to use any new syntax: Array.from(mySet) —Claude P.S. The syntax `[e for e of mySet]` is outdated in Harmony, you

Re: Set to Array conversions

2013-09-16 Thread Angus Croll
Thanks - I missed the obvious one I guess - though it still returns an empty array in continuum and traceur. e.g [...(new Set([1,2,3])].length; //0 or var s = new Set(); s.add('a'); s.add('b'); [...s].length; //0 assuming they just need to catch up @angustweets On Mon, Sep 16, 2013 at 8:42

Re: Set to Array conversions

2013-09-16 Thread Claude Pache
I suggest: [ ... mySet ] or, if you don't want to use any new syntax: Array.from(mySet) —Claude P.S. The syntax `[e for e of mySet]` is outdated in Harmony, you should use `[(for let e of mySet) e]`. Le 16 sept. 2013 à 17:33, Angus Croll a écrit : > I'm trying to figure ou