Looking at your implementation, I find it weird that a you modify the Function prototype (the same functionality could be done w/o it obviously) Now - don't get me wrong - I'm a mootools user, so modifying the prototype is something I'm quite used to, but still - it seems like a bad habit for a cross-lib package
On Thu, Jan 20, 2011 at 12:17 AM, mckoss <[email protected]> wrote: > I've been using a namespace pattern I developed and would love to get > feedback on my implementation/design. I know there is some wheel re- > invention here - I just have not yet found other patterns I like as > well. > > > http://code.google.com/p/pageforest/source/browse/appengine/static/src/js/namespace.js > > My goals were to create something that felt very close to python > modules, and be natural in the JavaScript world. > > I was also concern with out-of-order <script> inclusion, so namespaces > are created by this central library so inter-namespace references do > not rely on load order of scripts. > > A typical pattern of use would be: > > namespace.lookup('org.startpad.base').define(functionOnce(ns) { > var util = namespace.util; > var other = ns.lookup('org.startpad.other'); > > function exportedFunction() { > ... > var foo = new other.ExternalClass(); > .... > } > > ns.extend({'exportedFunction': exportedFunction}); > > Thanks! > Mike Koss > > -- > To view archived discussions from the original JSMentors Mailman list: > http://www.mail-archive.com/[email protected]/ > > To search via a non-Google archive, visit here: > http://www.mail-archive.com/[email protected]/ > > To unsubscribe from this group, send email to > [email protected]<jsmentors%[email protected]> > -- Arieh Glazer אריה גלזר 052-5348-561 http://www.arieh.co.il http://www.link-wd.co.il -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/[email protected]/ To search via a non-Google archive, visit here: http://www.mail-archive.com/[email protected]/ To unsubscribe from this group, send email to [email protected]
