local

Brendan Eich brendan at mozilla.org
Sat Aug 23 19:22:14 PDT 2008


On Aug 22, 2008, at 11:10 AM, Jon Zeppieri wrote:

>> So let statements really are different from let declarations in  
>> blocks.
>
> I didn't know that JS 1.7 already implements different binding
> semantics for let declarations on one hand and let statements and
> expressions on the other.  That's odd.

ES4 as proposed for quite a while.


>   I can see why you might want
> different semantics, but using the same keyword in both cases is a bit
> gross.

The introduction of letrec as a keyword seems grosser, especially for  
the mass of JS programmers.

The ES4 proposal used let (head) body as the distinguishing mark,  
where body could be an expression or a block. We haven't heard  
complaints about using parens instead of more or longer keywords; on  
the other hand, I don't think anyone is really using the unique  
capabilities of these non-hoisting binding forms (to put in the  
initialiser for a binding in head the same name being bound, and have  
it refer to an outer binding).

The language may not support too many binding forms. The TC39  
committee probably won't. Both let and const as block-scoped bindings  
in the style of var (but with use before set of a const illegal, and  
with const having a mandatory initialiser even though it saves  
implementations no cost) seem supported by those who spoke up at the  
last meeting. let blocks and let expressions do not have solid  
support in TC39.

/be
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.mozilla.org/pipermail/es-discuss/attachments/20080823/d0c507db/attachment.html 


More information about the Es-discuss mailing list