As previously mentioned, we've decided to allow "const" variable
declarations into ES3.1 under the "parses on 3/4 browser rule"
(FF,Safari,Opera) since it also aids integrity. However, it's a bit
mysterious how to declare formal parameter variables to be const in a
way that'll parse on 3/4 browsers. Both Firefox and Safari reject

    function foo(x, const y) { return [x, y];}

as a syntax error. However, they both accept

    function foo(x, y) { var y; return [x, y];}

and they correctly do not  treat the "var x;" as shadowing the "x"
parameter variable. So I thought I'd try

    function foo(x, y) { const y; return [x, y];}

On FF 2.0.0.14 under squarefree this gives a "TypeError on line 1:
redeclaration of formal parameter y". On Safari it parses fine, but of
course that the const-ness is not yet enforced.  Would ES4 interpret
the above syntax as declaring the "y" parameter variable to be const?
If so, what immediate plans do FF and Opera have re this syntax? If
both expect this to parse soon, perhaps we should stretch our 3/4 rule
and permit it? If not, any other suggestions for declaring formal
parameter variables to be const in ES3.1?

-- 
    Cheers,
    --MarkM
_______________________________________________
Es4-discuss mailing list
Es4-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es4-discuss

Reply via email to