frozen v. mutable

Lars Hansen lhansen at
Tue Jun 17 08:53:31 PDT 2008

> -----Original Message-----
> From: es4-discuss-bounces at 
> [mailto:es4-discuss-bounces at] On Behalf Of Brendan Eich
> Sent: 17. juni 2008 17:26
> To: Mark S. Miller; Waldemar Horwat
> Cc: es4-discuss at es4-discuss; 
> es3.x-discuss at x-discuss
> Subject: Re: frozen v. mutable
> > IIUC, our
> > meaning for it is exactly the meaning in ES4: the variable is 
> > letrec-scoped to its containing block (as with ES4 "let") but the 
> > variable is also unassignable. The variable declaration must provide

> > an initial value. An assignment to a const variable causes the
> > to be statically rejected. The variable is initialized when its 
> > initializing declaration is executed. (i.e., unlike functions, a
> > variable's initialization is not hoisted to the beginning of its
> > block.) Any attempt to read the variable before it is initialized 
> > fails. In strict mode this failure is a throw. In non-strict mode,
> > failure is the reading of undefined.
> Did we agree to allow undefined be read before the 
> declaration was evaluated? I thought at least Waldemar wanted 
> const use before def always to be an error, in standard as 
> well as strict mode.

That is indeed the current ES4 design; reading before initialization
always causes an error to be signalled.  Ditto for 'let'.  And of
course const properties are write-once, there's no need to initialize
it in the definition.


More information about the Es4-discuss mailing list