September TC39 meeting notes
Waldemar Horwat
waldemar at google.com
Fri Oct 3 16:05:36 PDT 2008
Igor Bukanov wrote:
> 2008/10/3 Waldemar Horwat <waldemar at google.com>:
>> An open issue is whether const violations should be compile or run-time errors. Clearly some of them are undecidable and can only be reported at run-time, but what about the clear-cut cases?
>>
>> {
>> a = x;
>> const x = 2;
>> }
>
> It would be nice if a compilation error is reported for
>
> const x = x + 1;
>
> This way ECMAScript can beat C++ where
>
> const int i = i + 1;
>
> is syntactically valid and the language does not require any
> diagnostic from the implementation.
>
> Regards, Igor
It definitely won't be as bad as C++'s behavior here (gcc accepts some of these without warning and simply leaves i uninitialized in the sequel of the code).
const x = x + 1;
will be at least a run-time error. Whether it should be a compile-time error is open for discussion.
Waldemar
More information about the Es-discuss
mailing list