That's a good point.  If I were to boil namespace.js down to it's
essentials, I don't even rely on the Function.prototype.methods call
(except that I
wanted to use if for clarity of implementation in the namespace object
itself).  The Class definition pattern I want to use is:

function ClassName() {
}

ClassName.methods({
     methodOne: function ...,
     methodTwo: function ...
});

I suppose I could change that to:

namespace.methods(ClassName, {...});

Just not quite a clear (to me).

On Jan 20, 5:07 am, אריה גלזר <[email protected]> wrote:
> 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/sr...
>
> > 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%2Bunsubscribe@googlegroups 
> > .com>
>
> --
> Arieh Glazer
> אריה גלזר
> 052-5348-561http://www.arieh.co.ilhttp://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]

Reply via email to