`static` keyword from C/C++ as own closured var declaration

Mark S. Miller erights at google.com
Tue Nov 23 08:35:10 PST 2010


On Tue, Nov 23, 2010 at 2:12 AM, Asen Bozhilov <asen.bozhilov at gmail.com>wrote:

> David Herman:
>
> >> // "new" more readable sugar
> >> function()
> >> {
> >>  static x = 1; // hello c/c++
> >>
> >>  return ++x;
> >> }
>
> This would produce incompatibilities with ECMAScript 5 non-strict
> code.  The word `static` can be used as an Identifier in ES5
> non-strict mode.
>

Any ES5 non-strict code that uses "static" as an identifier is already
incompat with ES5/strict, so this is not an issue. The case against "static"
seems strong, but this does make it stronger.


> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>



-- 
    Cheers,
    --MarkM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20101123/4b0e733e/attachment.html>


More information about the es-discuss mailing list