On Sat, Mar 28, 2009 at 9:02 AM,  <[email protected]> wrote:
> But why is it curious to have an external on the global? The global
> is an object template and becomes an object instance as all others
> so..

i just hadn't seen it done before (and had no need for it), that's
all. In JS the global object isn't "accessible" to the caller (it has
no name/symbol), so i've never tried to tie native data to it other
than InvocationCallback functions, classes, and such.

> Hmm.. that sounds interesting though even after reading your article
> I am not perfectly sure when that could happen? How could you ever
> be able to "pass" something else into the Holder() value?

var foo = new Foo();
var bar = new Bar();
bar.somefunc = foo.somefunc;
bar.somefunc()

segfault! (or at least an error)

The approach covered in the article (and corresponding code) will
instead throw an exception saying "could not find native 'this'
pointer". The second part of the article (which is separate because it
need supplemental code from v8-juice, whereas the first part can be
used in standalone v8 code) can also handle native inheritance, such
that an inherited member function can get its "this" pointer
polymorphically from "down the hierarchy tree":

http://code.google.com/p/v8-juice/wiki/ClassBinder

-- 
----- stephan beal
http://wanderinghorse.net/home/stephan/

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

Reply via email to