Module system strawpersons
kamkasravi at yahoo.com
Mon Jan 18 14:50:26 PST 2010
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 deanlandolt.com>
To: Kam Kasravi <kamkasravi at yahoo.com>
Cc: Andy Chu <andy at chubot.org>; kkasravi <kkasravi at me.com>; Brendan Eich <brendan at mozilla.com>; es-discuss <es-discuss at mozilla.org>
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 yahoo.com> 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...
More information about the es-discuss