return when desugaring to closures

Brendan Eich brendan at mozilla.com
Mon Oct 13 17:39:15 PDT 2008


On Oct 13, 2008, at 5:29 PM, Waldemar Horwat wrote:

> Brendan Eich wrote:
>> On Oct 13, 2008, at 3:51 PM, Waldemar Horwat wrote:
>>
>>> Brendan Eich wrote:
>>>> After some experiments, we decided for ES4 to make let and var the
>>>> same at top level in a function or global code.
>>>> ...
>>> You can't do that.
>>
>> Which "that" do you mean?
>
> Turn let into var at the top level of a function body.

Ok then!


>>> function f() {
>>> x = 15;
>>> ...
>>> let t = some_runtime_expression;
>>> ...
>>> let x:t = ...
>>> }
>>>
>>> What is the type of x at the beginning of the function?
>>
>> The example had better fail to compile.
>
> Because presumably the "let x:t" became "var x:t" and var can't have  
> types?

Why can't var have a type annotation?


> You can't be serious that let would be broken unless enclosed by an  
> independent block!

I didn't say that :-P.

/be



More information about the Es-discuss mailing list