Nested modules clarification

๏̯͡๏ Jasvir Nagra jas at nagras.com
Wed Jul 18 09:15:16 PDT 2012


On Wed, Jul 18, 2012 at 4:25 AM, Sam Tobin-Hochstadt <samth at ccs.neu.edu>wrote:

> On Wed, Jul 18, 2012 at 2:37 AM, ๏̯͡๏ Jasvir Nagra <jas at nagras.com> wrote:
> >
> >
> > On Tue, Jul 17, 2012 at 11:21 PM, David Herman <dherman at mozilla.com>
> wrote:
> >>
> >> On Jul 17, 2012, at 9:17 PM, ๏̯͡๏ Jasvir Nagra wrote:
> >>
> >> However, Module Semantics
> >> (http://wiki.ecmascript.org/doku.php?id=harmony:modules_semantics)
> suggests
> >> that each inline module declaration introduces a fresh scope.
> >>
> >>
> >> As in, a fresh *nested* scope.
> >
> >
> > Ah that was definitely not clear to me from reading the spec or the
> > examples.  What outer bindings can be referred to - any lexically scoped
> > variables or just other module definitions?
>
> Lexical bindings as well as module definitions:
>
> module outer {
>   let x = 1;
>   export module inner {
>     export y = x + 2;
>   }
> }
>

That's a little unexpected.  Would the same hold if the above code was
refactored so the inner module was a separate file?

module outer {
  let x = 1;
  export module inner = "http://m/inner.js";
}

If not, should a module inliner be doing variable renaming in order to
maintain semantics?

--
> sam th
> samth at ccs.neu.edu
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120718/d98b8a1e/attachment.html>


More information about the es-discuss mailing list