Module system strawpersons

Kam Kasravi kamkasravi at
Mon Jan 18 14:50:26 PST 2010

Hi Dean
Yes I was talking about the commonjs pattern where objects are extended or aggregated by modifying their exports.
I was thinking of an API where a module could be queried for dependencies, its 'public' methods or other types of 
meta info via a common API. It would be a good place to define policies. Depending on the caller/context, different things 
could be returned, wrapped or delegated - eg friends (c++), proxies (catchalls), strategy patterns etc.


From: Dean Landolt <dean at>
To: Kam Kasravi <kamkasravi at>
Cc: Andy Chu <andy at>; kkasravi <kkasravi at>; Brendan Eich <brendan at>; es-discuss <es-discuss at>
Sent: Mon, January 18, 2010 1:54:34 PM
Subject: Re: Module system strawpersons

On Mon, Jan 18, 2010 at 4:27 PM, Kam Kasravi <kamkasravi at> wrote:

>yes I was referring to the circular dependency issue.
>Catch-alls would be useful for this, though it would be nice if 
>>they were automated, eg returning a proxy until the module was used.
>Doing it manually by developer would be too difficult.
>I realize modules are intended to just satisfy a function body and 
>can be initialized as objects or called as functions, but since they 
>>have strong container semantics I wonder if they should 
>have more than just an 'id' especially if they provide a gateway 
>to what else is in the directory as in commonjs.

Can you clarify what you mean by "provide a gateway"? AFAIK the only gateway a commonjs module provides is that which is explicitly added its exports object, which can be required modules from anywhere in require.paths. Also, in the context of commonjs SecurableModules, as the spec stands, modules cannot be called as functions. However if Harmony were to bless a module system (or at least a means to create module systems) it would be wonderful if this oft-requested feature would be considered.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list