Rick Waldron (2013-07-11T00:32:28.000Z)
On Wed, Jul 10, 2013 at 7:49 PM, Andrew Fedoniouk <news at terrainformatica.com
> wrote:

> On Wed, Jul 10, 2013 at 4:24 PM, Rick Waldron <waldron.rick at gmail.com>
> wrote:
> >
> >
> >
> > On Wed, Jul 10, 2013 at 7:15 PM, Andrew Fedoniouk
> > <news at terrainformatica.com> wrote:
> >>
> >> Consider this simple construct:
> >>
> >> module "test" {
> >>     export function setVar() {
> >>         gvar = "GVAR";               // note 'gvar' is not defined in
> the
> >> module
> >>     }
> >>     export function getVar() {
> >>         return gvar;
> >>     }
> >> }
> >>
> >> module Test from "test";
> >>
> >>
> >> Having this in place I am calling
> >>
> >> Test.setVar();
> >>
> >> Question: where is that 'gvar' created? Possible case:
> >>
> >> a. {{globalns}}.gvar == "GVAR"   // so in global namespace or
> >> b. {{globalns}}.Test.gvar == "GVAR" // in module namepspace
> >>
> >> In other words does the module establish its own dynaimic
> namespace/scope?
> >>
> >> If that behavior is spec'ed already I'll appreciate for the link.
> >
> >
> > It gets created nowhere, because the body of a module is implicitly
> strict,
> > so the above code produces a Reference Error.
> >
> > Rick
> >
>
> Thanks Rick. And I suspect there is no way to reclaim that strictness,
> right?
>

One of the goals of ES6 (and all future versions) is to promote strict mode
to become the "only" or at least "preferred" mode. Wherever reasonably
possible new syntactic forms, such as class and module, will be designed as
strict by default, with no "opt out".


Rick


>
> Asking because it could be useful in cases like this :
>
> module "Safe" {
>    "not use strict";
>     export function eval(str) {
>          return std.eval(str);
>     }
> }


> And so if I will call:
>
> Safe.eval("gvar=666") ;


> it will not pollute global namespace.


> --
> Andrew Fedoniouk.
>
> http://terrainformatica.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130710/805ca1af/attachment.html>
domenic at domenicdenicola.com (2013-07-13T01:08:47.882Z)
On Wed, Jul 10, 2013 at 7:49 PM, Andrew Fedoniouk <news at terrainformatica.com> wrote:

> Thanks Rick. And I suspect there is no way to reclaim that strictness, right?

One of the goals of ES6 (and all future versions) is to promote strict mode
to become the "only" or at least "preferred" mode. Wherever reasonably
possible new syntactic forms, such as class and module, will be designed as
strict by default, with no "opt out".