> -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Brendan Eich > Sent: 17. juni 2008 17:26 > To: Mark S. Miller; Waldemar Horwat > Cc: [email protected] es4-discuss; > [EMAIL PROTECTED] 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 program > > to be statically rejected. The variable is initialized when its > > initializing declaration is executed. (i.e., unlike functions, a const > > 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, the > > 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. --lars _______________________________________________ Es4-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es4-discuss
