I appreciate this thread as it has made me aware of the CommonJS effort which is of dear interest. I will certainly continue there, however I simply want to contribute the work I have done to find the ECMAScript way to manage packages and classes. For reference, and whatever value it may have, this is a bare-bones implementation which matches what you propose:

Documentation: http://support.livesite.net/products/es/docs/?doc=es1.doc
Source: http://support.livesite.net/products/es/es1.js

And should there be any further interest, you can see a bit of what I have built upon this system:
http://support.livesite.net/products/es/

Cheers,
-Ryan

On 12/02/2009 01:36 AM, Michael Haufe wrote:
On Tue, Dec 1, 2009 at 10:59 PM, Mark A. Ziesemer <[email protected] <mailto:[email protected]>> wrote:
> I'm sorry - I may very well be missing something, but I don't see how
> this is at all related (?).  What I'm proposing would be somewhat
> related to the YAHOO.namespace function
> (http://developer.yahoo.com/yui/docs/YAHOO.html), though without being
> limited to children of the "YAHOO" global object.  Actually, the YAHOO
> version and others would be able to utilize the version I'm proposing
> within their versions.

If the point is to prevent pollution of global code, the proposed module system solves that more securely since it can prevents 3rd party code from doing anything nasty. There is also a related package system they are discussing:
http://wiki.commonjs.org/wiki/Packages

I've been burned in the past by bad libraries using this idea, so I'm weary of it admittedly.
Peter Michaux wrote an excellent article on the subject here:
http://peter.michaux.ca/articles/javascript-namespacing
Though I don't agree with his solution of using an underscore naming convention, I believe he does justice in defining the problem.


_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to