Thanks, I was just thinking that as there is GetPrototype() and SetPrototype() for objects, which access '__proto__', there should be also for 'prototype'. I'd like to use the topic to ask - what does GetPrototype() actually return on a function object then? Is it func.prototype.__proto__?
On Mar 13, 3:50 pm, Matthias Ernst <[email protected]> wrote: > On Tue, Mar 13, 2012 at 2:26 PM, avasilev <[email protected]> wrote: > > Hello, > > Is there a way to get a function's prototype, equivalent to the > > function's 'prototype' property, e.g.: > > > function Func() > > {} > > var a = Func.prototype; > > > Using Object::GetPrototype() does not do the same and returns a > > different value. Setting an object's prototype via SetPrototype() to > > the property value gives the desired effect of instanceof recognizing > > the object as constructed by the function. Setting the prototype to > > the function's GetPrototype() does not achieve this. > > From the doc I don't see a way to access the "prototype" property of a > > function, besides getting it as an ordinary property via func- > >>Get(String::New("prototype")); > > Am I missing something? > > I don't think you are. Why should there be another way, apart from > convenience? If JS specifies it as a property, especially not even a > special one, then use the property accessor. You may of course argue > that it's inconsistent with, say, Array::Length. > > > > > > > > > > > Greetings > > Alex > > > -- > > v8-users mailing list > > [email protected] > >http://groups.google.com/group/v8-users -- v8-users mailing list [email protected] http://groups.google.com/group/v8-users
