n Wednesday 07 October 2009 16:02:28 kangax wrote:
> On Oct 7, 9:16 am, Jim Higson <j...@wikizzle.org> wrote:
> > On Wednesday 07 October 2009 13:52:56 Jim Higson wrote:
> > > Forked an untested implementation:
> > >
> > >http://gist.github.com/204008
> >
> > Ah, just had a better idea and edited again. Does the same but without
> > adding new Elements to the document and without requiring observable
> > object instances to have any kind of always knowable global namespace.
> >
> > now:https://gist.github.com/204008/857971039083d293b036fdfd012f189d5cb566
> >2e
>
> Now imagine that every time you create an instance, not only is it
> taking a perf. hit at run time by being augmented with 4 "observable"
> methods, those methods are also unique for each instance; They aren't
> shared off of instance's prototype.

True, but other than adding secret properties to this, this is the only way to 
store per-instance state from a mixin-like thing.

In practise, the performance hit is unlikely to be significant/noticable and 
IMO the ability to use all of per-instance, per-class and per-everywhere state 
from a mixin is powerful enough to be worth (small) linear space per object.

> That's 4N function objects, instead of what could have been - 4
> (although 4 comes with its own cost of course) :)

-- 
Jim
my wiki ajaxification thing: http://wikizzle.org
my blog: http://jimhigson.blogspot.com/

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to 
prototype-core-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to