New issue 31 by korz.nik...@gmail.com: V8Convert JavaScript Inheritance
http://code.google.com/p/v8-juice/issues/detail?id=31
What steps will reproduce the problem?
1. Subclass a native class in JavaScript
2. Create an instance of the subclass
3. Call an inherited (at least I expected it to be inherited) method
What is the expected output? What do you see instead?
Expected: The method should run fine
Instead: "Uncaught Error: CastFromJS<T>() returned NULL! Cannot find 'this'
pointer!"
What version of the product are you using? On what operating system?
Version: Revision 2206
OS: Mac OS X 10.7
For this behaviour to work you also need to tell the class binding
mechanism that it should check the JS prototype chain for the "this"
object. In the ClassCreator you can do this by adding the following
template:
namespace cvv8 {
template <>
struct ClassCreator_SearchPrototypeForThis<MyType> : Opt_Bool<true>
{};
}
Actually... the default impl of this class uses "true", which implies that
i might have broken this.
If i'm not mistaken, you also need the horribly ugly workaround described
here:
http://code.google.com/p/v8-juice/wiki/ClassBinderPartTwo#Inheriting_Native_Classes_from_JS
It works with your 'horrible workaround'. Though that is incompatible to
CoffeeScript, which is kind of said. Any chance of that getting fixed? :-/
i don't know _how_ to fix it :/. The only workaround i've ever found which
works (in the sense that (this instanceof TheNative) works) is that ugly
workaround. If you've got any ideas on how to solve it i'd love to hear
them.