What would a 1JS-friendly strict mode look like?

Till Schneidereit till at tillschneidereit.net
Thu Dec 18 10:32:21 PST 2014

On Thu, Dec 18, 2014 at 6:50 PM, Felipe Nascimento de Moura <
felipenmoura at gmail.com> wrote:
> did anyone see my suggestion?
> (actually, am not sure my e-mails are going out!)

> Personally(again, my opinion), I think it is at least weird, having a
> "floating string" on your code! Specially because(by now) this is the only
> situation, with only one option, what makes it an "exception".
> ES has so many great patterns, the least exceptions for the rules, the
> better!
> That's why I thought about a "scope" token/accessor.
> Besides that, some advantages such as enabling experimental features or
> not, safe mode, etc.
> When I think about it, new ideas come!
> Let's say you may use:
> scope.set("debug", ["error", "call");

Strict mode is a static, compile-time setting, not something that can be
modified at runtime. Hence, your suggestion falls short, because it would
be a runtime setting.

the reason why a "floating string" was used is to not introduce syntax that
older engines would trip over. Something like `use strict` (without the
quotes) would cause that. You might say that `scope.set` would only be
allowed at compile time or something, but that would be problematic both
because it's not backwards-compatible (what if code uses a collection
called "scope"?) and because it's not distinguishable from normal code.

Also, "use strict" has been around for years and nothing will ever get it
removed/replaced, anymore.

> and this would cause any function call inside this scope, to stop(if a
> console is opened) pausing the flow for debugging, or also, when any error
> occur inside it.
> Other things could be done to log calls, as well(changing the verbosity of
> the scope).
> Sorry if this idea is stupid and I can't see it! hehe
> Regards.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20141218/18ae7d21/attachment.html>

More information about the es-discuss mailing list