I am not sure that what you are doing is necessary (or that i don't really
understand what it is that you are doing. i could really use a use-case
example).
Class.instantiate does exactly what i was doing - passing a function's
prototype to the function's apply call (nice to know this method exists :-)
).

Now, specifically, within the Class function statement, there is already a
call to initialize. so i'm having a hard time understanding when is it
necessary to call Class.instantiate on a function, then call it's
initializer (which, BTW, i'm having a hard time thinking of a use case when
a function will have an Initialize method).

so - to wrap it up - i'm more and more convinced that i'm simply not
understanding what it is that you are doing with you Invoke method...
-----------
אריה גלזר
052-5348-561
5561


On Mon, Apr 19, 2010 at 21:58, kentaromiura <[email protected]> wrote:

>
> No, is not quite the same,
> If you look at the first version of my gist here:
> https://gist.github.com/299387/bc1f3286c7e695b38786b8aa8d94224c11d48113
> you will see that to apply for a mootools class, you must using new on
> the class, without initialize, because if you define properties, these
> must be loaded before initialize, than after calling new on the class
> without initialize, you can apply the initialize passing the object
> you created masking the initialize...
>
> it works, but after talking with the mootools dev I found another
> simpler way, using Class.instantiate
> and then applying for initialize like in this gist:
> https://gist.github.com/299387/1cf26bf83a0a351e70c63e7044276857572a5e23
>
> @Sanford:
> I used my approach in my IOC container :
> http://gist.github.com/299395
> as you see, I never call new, because I use Class.Istantiate, If
> you're asking me if istanceof will work, yes, it works :)
>
>
> On 18 Apr, 13:01, אריה גלזר <[email protected]> wrote:
> > Found it! calling apply with the function's prototype  (
> > Class.apply(Class.prototype,[...]) ) is the same as calling new.
> >
> > hope i'm not embarrassing myself, but the main difference between calling
> a
> > function and using 'new'  (at least the way i understand it) is the
> object '
> > this' points to.http://www.jsfiddle.net/c2dtW/
> >
> > This way we can create costum factories to any Function\Object\Class we
> > like.
> >
> > -----------
> > אריה גלזר
> > 052-5348-561
> > 5561
> >
> > On Thu, Apr 15, 2010 at 21:34, Sanford Whiteman <
> [email protected]
> >
> >
> >
> > > wrote:
> > > > I think you wanna look at this gist ;)
> >
> > > >http://gist.github.com/299387
> >
> > > Can  you put up a demo of using operator new + opaque arguments object
> > > + returning an instanceof Class using your approach?
> >
> > > -- S.
> >
> > > --
> > > To unsubscribe, reply using "remove me" as the subject.
>

Reply via email to