Composition of Uncoordinated Working Sets of Modules

Kris Kowal kris.kowal at cixar.com
Mon Jun 7 15:24:41 PDT 2010


On Mon, Jun 7, 2010 at 12:10 PM, Erik Arvidsson
<erik.arvidsson at gmail.com> wrote:
> On Mon, Jun 7, 2010 at 10:35, Kris Kowal <kris.kowal at cixar.com> wrote:
>>
>> Another thing that Ihab clarified which merits a full
>> section on the wiki is the dynamic scoping of lexical module
>> names.
>
> This is a common misconception. Simple modules is using static lexical
> scoping, not dynamic scoping. The thing that might be confusing is that the
> loaded module is defined in the lexical scope of the module that loaded it.

Reviewing the idea, it's certainly not dynamic scoping.  If you're
very free with the analogy to a function call as established by the
syntax, I recklessly intuited that there's a case for it sharing the
analyzability problem that dynamic scoping causes, but I have not
found such a case. However, you cannot statically observe a reference
error on a single script in isolation; you need to know the lexical
scope in which it has been loaded.  I don't think that's necessarily a
problem.  It's certainly the same case with any situation where
successive script tags have access to the modules declared by previous
scripts.

Kris Kowal

(For anyone observing the political mess I've made, I do plan to do a
write-up redacting my claim that Simple Modules can't be used to
compose independently designed scripts.  I think this is the big issue
and I'm glad this design has a solution.  I'll continue to ponder the
implications for CommonJS and see if I can come up with a migration
story that makes sense.)


More information about the es-discuss mailing list