On Sun, Jun 26, 2011 at 12:44 AM, Louis Santillan <[email protected]>wrote:

> To be honest, I've been working on this idea (using macros) too. To
>

Macros are, long-term, problematic and normally not compile-time-typesafe.
One of the main benefits of a template-based binding mechanism is that we
can catch all kinds of errors at compile-time. If a binding compiles, it's
legal. (That's not to say that the data passed in at runtime will
necessarily be semantically legal, of course.)


> bring some sort standards to this work, I've been trying to follow
> some of the ideas in mozilla's ctypes interface. A kind of ctypes-lite
>

i'm not familiar with ctypes.


> interface.  But I really like your solution. I might have to ditch
> most of my work.


:-D

The v8::convert lib is header-only, so porting it in to your tree should be
easy. Please get in touch off-list if you decide to try.

The type conversion API originally started out in a SpiderMonkey C++
binding, and it worked really well there. Back then i used it to implement
the world's first (to the best of my knowledge) JS bindings for sqlite3 and
ncurses (http://spiderape.sourceforge.net/screenshots/). (At that point the
concept of converting not just types, but also function signatures, was
still far away.) When i found v8 i quickly ported it over (and dumped by
SpiderMonkey-based work). i've been very pleased with its ease-of-use and
client-side extendability (by adding template specializations which perform
the conversion). There are internally a few rough corners (e.g. ugly
home-rolled metatemplate programming utils instead of using boost::mpl or
similar), but in my experience it works really well and is easy to use. (And
did i mention compile-time safe? ;) And it's got probably 100 times more
docs than v8 does (almost 400kb of wiki text and some 39% of the source code
is comments/API docs, according to Ohloh.net).

Happy Hacking!

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

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

Reply via email to