Hi, I've been reading the embedders guide, and the docs that are generated from the source code comments for a while, and experimenting. I just can't seem to get a good overview of how the entire system of objects, contexts, templates, functions, etc work together.
For one thing, it seems to matter a lot when you Set something on an object (before/after it's added to a global object, and before/after that global object has been added to a context), whether it's an object, an objecttemplate, instance or whatever. I have a hard time finding example code, beyond what exists on the google code page, and I keep having this nagging feeling that I am missing some kind of treasure trove of documentation somewhere. I keep getting lost in a forest of foo, foo->InstanceTemplate, foo- >ObjectTemplate, foo->FunctionTemplate, etc, etc. I'm an experienced c++ programmer (and js programmer), and normally I have no problem with diving into sparsely documented stuff, but there seems to be so much magic going on behind the scenes in v8 that I have a very hard time relying on anything but documentation and examples. And I'm having trouble finding much of that. Trying to inspect v8 stuff in the debugger doesn't work very well either, most of the time. So, how did you people get a handle on v8? Do you know of good examples of v8 usage with lots of source available? I am struggling with things like this: - Understanding the relationship between FunctionTemplate and InstanceTemplate (I thought I got it, but I still can't write code that works) - Creating constructor functions in the global space that can be used from JS, for example (js): var sprite = new ZSprite(); - Creating a member function on a constructor function (kinda like a static method in c++), so I can call it like this (js): var sprite = ZSprite.create( "foo.png" ) I've looked a bit at http://create.tpsitulsa.com/blog/2009/01/29/v8-objects/, and some of the info I am seeking seems to be there, but I still can't get my stuff to work. And generally, I'm just randomly trying stuff too much - I'd like to be programming deliberately, not by accident. Any pointers to how to go about grokking v8, the way to use it and how the "correct" way to map the c++ and js spaces to each other would be hugely appreciated. Thanks. /Brian -- v8-users mailing list [email protected] http://groups.google.com/group/v8-users
