Module system strawpersons

Andy Chu andy at chubot.org
Mon Jan 18 12:40:35 PST 2010


On Mon, Jan 18, 2010 at 10:29 AM, Kam Kasravi <kamkasravi at yahoo.com> wrote:
> Yes, that looks right, I also remember a reference to the 'dot' notation
> where namespace
> access would be arbitrated implicitly by objects representing the '.' It may
> have been in
> one of Lars Hansen papers on gradual typing. In any case there was some good
> discussion
> on meta-level objects and controlling capabilities or access.
>
> Was there any discussion in the past about parameterized modules or
> units where recursively nested modules/units were brought up? If two modules
> refer to each other
> and all imports are resolved eagerly then I think this would be a problem
> where use cases would
> abound.

What are you referring to here?  I think you are hinting at the
problem of circular dependencies using "import" semantics like Python
and CommonJS.  Right now if you have mutually recursive modules, you
get partially initialized modules, because the "program counter" just
follows every require().  The CommonJS spec specifically allows the
partially initialized modules I think.

Personally I try to break up circular dependencies, but this behavior
is not very friendly, so I think it would be better if Harmony
supported circular dependencies in a more "correct" way.  So this is
an advantage of the "makers" style semantics (separating module
definition and configuration).

The Newspeak paper talks explicitly about this:
http://scholar.google.com/scholar?hl=en&source=hp&q=objects%20as%20modules%20in%20newspeak&um=1&ie=UTF-8&sa=N&tab=ws

If you are initializing modules in topological order, and there is a
circular dependency between A and B, he says to just make a dummy
proxy object for B to pass into A, initialize A, and then initialize
B.

That also reminds me that a good use case for catchalls is making
module-like objects.  I haven't seen any discussions of the 2 together
but it's definitely worth thinking about how they interact.

Andy


More information about the es-discuss mailing list