Conflicting declarations -- Was: Re: local

Ingvar von Schoultz ingvar-v-s at comhem.se
Sat Aug 23 08:02:17 PDT 2008


Brendan Eich wrote:
> This past April at the ES4 WG meeting we decided to make let equate to 
> var at top level within a function body or program.

That's good news.

> Another thing we do that's a bit harsh is to call repeated let x; 
> declarations in the same explicit block an error.

This is good for big projects that need discipline and organization,
/if/ the compiler throws an error on undeclared variables. But as
I've mentioned elsewhere, I see important drawbacks in the opposite cases.

I think it would be a good idea to consider varying this between
subset cautious and subset reckless.

(Well it needs a name, doesn't it?)

> On Aug 22, 2008, at 7:26 AM, Ingvar von Schoultz wrote:
>> In my opinion this is not a useful feature, quite the contrary.
>> If the variables are far apart on the page, the disappearance of
>> one of them will be mysterious and difficult to debug.
> 
> It's also a pain to implement in few passes at top level, if one prefers 
> to parse a top-level statement at a time and recycle the AST after 
> generating code.

I'm surprised, I thought making synonyms would be easy.

-- 
Ingvar von Schoultz



More information about the Es-discuss mailing list