Allowing for stricter subsets in future versions

Mark S. Miller erights at google.com
Mon Oct 27 19:21:13 PDT 2008


On Mon, Oct 27, 2008 at 7:11 PM, David-Sarah Hopwood
<david.hopwood at industrial-designers.co.uk> wrote:
> It may be necessary in future to add additional incompatible restrictions
> along similar lines to strict mode, for example to support the work on
> 'Secure ECMAScript'. In that case, it's very likely that code written
> in such a subset should turn on the "strict" restrictions if it is
> running on an ES3.1 implementation, plus the additional restrictions
> if it is running on some later version. To do that it would be necessary
> to say something like:
>
>  "use strict"; "use stricter";
>
> which is ugly and redundant. The redundancy can be avoided by specifying,
> in ES3.1, that the strict literal that turns on strict mode only needs
> to *start* with "use strict". For example, in that case
>
>  "use stricter";
> or
>  "use strict+secure";
>
> would be sufficient for code in the stricter subset. There is no
> significant down-side if such a subset turns out not to be needed.

In Redmond we adopted essentially this same idea, but with comma as
the separator. Strict mode is indicated by an initial strict literal
expression statement containing exactly

    use strict

or a string literal expression statement beginning with exactly the prefix

    use strict,

ES3.1 does not suggest any interpretation of the characters after the comma.

-- 
    Cheers,
    --MarkM


More information about the Es-discuss mailing list