return when desugaring to closures

Brendan Eich brendan at mozilla.org
Thu Aug 21 18:54:21 PDT 2008


On Aug 21, 2008, at 6:47 PM, Mark S. Miller wrote:

> On Thu, Aug 21, 2008 at 6:34 PM, Brendan Eich <brendan at mozilla.org>  
> wrote:
>> js> [d,e,f] = foo()
>> 1,2,3
>
> Is this a simultaneous assignment of d,e,f, or does it declare  
> variables d,e,f?

The first.


> If the first, can you do a swap as
>
>     [d, e] = [e, d]

Sure can (variable values as in previous mail):

js> [a,b] = [b,a]
2,1
js> a
2
js> b
1
js> [d,e,f] = [e,f,d]
2,3,1
js> d
2
js> e
3
js> f
1

/be


More information about the Es-discuss mailing list