return when desugaring to closures
Brendan Eich
brendan at mozilla.com
Mon Oct 13 16:43:55 PDT 2008
On Oct 13, 2008, at 4:17 PM, Waldemar Horwat wrote:
> Brendan Eich wrote:
>> True enough -- but even without normalization, multiple equivalent
>> (at
>> runtime, depending on flow) annotations could be allowed. Should
>> they be?
>
> No. Just because the type matched the last five times you evaluated
> it doesn't mean that it will match the next time. Also, with
> multiple lets it's too easy to mistake the case of shadowing (when
> multiple let declarations are in nested blocks) with sharing (when
> they are far apart in the same block). You might refactor: ...
Same could happen for function definitions nested in blocks,
refactored to erase the blocks. It would be an error to redefine a
function with the same name and any type annotations (assuming we have
annotated functions -- function types), I take it?
If the answer is no, then I agree. The consequences of runtime types
have not been something I've thought a lot about, but it seems like
they make all binding forms like const: you cannot redefine a name in
the same block with any binding form.
/be
More information about the Es-discuss
mailing list