Nested modules clarification

๏̯͡๏ Jasvir Nagra jas at
Tue Jul 17 21:17:18 PDT 2012

Module Rationale ( suggests

   - Modules can be nested.

This makes it convenient to modularize code cheaply, without having to
create separate files. It is also consistent with the semantics that file
top-level is implicitly a module but can contain sub-modules. Finally, it
makes refactoring work well: code separated into modules can itself be
separated into a new parent module.

However, Module Semantics ( suggests
that each inline module declaration introduces a fresh scope.  Given this,
I am trying to understand whether there is any difference in semantics
between nested rather than sibling modules.

For example, is there any semantic difference between the following:

module widgets {
    export module button { ... }
    export module alert { ... }
    export module textarea { ... }
    ...}import { messageBox, confirmDialog } from widgets.alert;


module widgets.button { ... }
module widgets.alert { ... }
module widgets.textarea { ... }
 import { messageBox, confirmDialog } from widgets.alert;

...other than the change to the grammar that module name can now contain a

Jasvir Nagra
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list