|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
|
|
|
RE: frozen v. mutable> -----Original Message-----
> From: es4-discuss-bounces@... > [mailto:es4-discuss-bounces@...] On Behalf Of Brendan Eich > Sent: 17. juni 2008 17:26 > To: Mark S. Miller; Waldemar Horwat > Cc: es4-discuss@... es4-discuss; > es3.x-discuss@... 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 Es4-discuss@... https://mail.mozilla.org/listinfo/es4-discuss |
|
|
Re: frozen v. mutableOn Tue, Jun 17, 2008 at 8:53 AM, Lars Hansen <lhansen@...> wrote:
>> From: es4-discuss-bounces@... >> [mailto:es4-discuss-bounces@...] On Behalf Of Brendan Eich >> 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. My mistake. I'm happy to have it always throw. -- Cheers, --MarkM _______________________________________________ Es4-discuss mailing list Es4-discuss@... https://mail.mozilla.org/listinfo/es4-discuss |
| Free Forum Powered by Nabble | Forum Help |