return when desugaring to closures
David-Sarah Hopwood
david.hopwood at industrial-designers.co.uk
Mon Oct 13 13:22:41 PDT 2008
David-Sarah Hopwood wrote:
> Mark S. Miller wrote:
>> But what about "let". Do we all agree that in
>>
>> for (let x = ...) {...x...}
>> ... x ...
>>
>> the x after the for loop does not refer to the x defined by the for
>> loop?
>
> Yes, if this form is allowed. The other options are either to require:
>
> let x in { for (x = 0; x < 10; x++) {...x...} }
> or
> let x = 0 in { for (; x < 10; x++) {...x...} }
I meant:
let (x) { for (x = 0; x < 10; x++) {...x...} }
or
let (x = 0) { for (; x < 10; x++) {...x...} }
('let ... in' is similar to the 'local ... in' syntax that Oz uses, and
I think it reads better, but it can't be used in ECMAScript because
the part to the right of the identifier is ambiguous with an application
of the 'in' operator.)
--
David-Sarah Hopwood
More information about the Es-discuss
mailing list