On Wed, Mar 31, 2010 at 5:22 PM, Stephan Beal <[email protected]> wrote:

> On Mar 31, 1:37 pm, Matthias Ernst <[email protected]> wrote:
> > Works for me.
> ...
> >   ft->PrototypeTemplate()->SetIndexedPropertyHandler(GetValue);
>
> Now i'm even more befuddled. i tried various permutations of that, but
> none of the handlers were being called. When i switched to the
> InstanceTemplate it worked as expected. i only came across that idea
> by googling through 3rd-party sources while looking for a working
> example.
>
> On Mar 31, 2:09 pm, Matthias Ernst <[email protected]> wrote:
> > However:
> >
> > If you do instance->Set(Number::New(13), Number::New(14)), instance[13]
> will
> > return 14. With the accessor set on the instance template, the accessor
> is
> > called instead. The prototype accessor is only called if the property
> lookup
> > actually reaches the prototype.
>
> That might have been my problem (i'm not sure). i've bound a native
> class using the WeakPointer approach and don't have any inheritance
> other than the implicit Object parent.
>
> i'm still confused about the difference between the two, but
> InstanceTemplate works for me, so i'm happy. :)
>

If x was constructed from the instance of a function template ft, then the
lookup order for x.y is:

native accessor on x's template (= ft.instancetemplate)
property set on x
[ lookup failed on x => delegating to prototype ]
native accessor on x.prototype's template (= ft.prototypetemplate)
property set on x.prototype
...


> --
> v8-users mailing list
> [email protected]
> http://groups.google.com/group/v8-users
>
> To unsubscribe, reply using "remove me" as the subject.
>

-- 
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users

Reply via email to