Hello, fellow v8 hackers, i would like to announce a new v8-based project...
v8::convert is a header-only v8 utility library with a very small focus: - Converting between v8 and native values, including client-defined types. - Converting C/C++ functions/methods to v8::InvocationCallback implementations. With those two features we have almost everything we need for most class-binding purposes. The the ability to convert functions to have v8::InvocationCallback signatures has proven especially useful, and allows us to plug in in many C-standard or 3rd-party APIs with ease. Conversions are compile-time typesafe where possible and runtime conversion failures fail gracefully (e.g. by throwing a JS-side exception). The core components are in no way project-specific, and can be used in conjunction with arbitrary other function/class binding mechanisms. Since the implementation is header-only, it's particularly easy to include into other projects. The API is trivial to use. The client API contains a good number of classes and functions, but most client code needs only one or m/ore of the 5 main function templates: CastToJS(), CastFromJS(), FunctionToInvocationCallback(), MethodToInvocationCallback(), and ConstMethodToInvocationCallback(). The missing parts are: - Binding JS accessors to native values/functions. i have the code in v8-juice but need to port it to this API's conventions. - A class binding mechanism which takes care of the WeakPointer bits. There is such a mechanism in v8::convert, but it is not considered a core component because hackers tend to each have their own favourite class binding mechanism. The code is largely a spin-off of the core-most v8-juice components, but the function-binding parts were re-implemented from scratch so that we can use function-pointer-style template parameters (which, IMO, are more readable than the v8-juice's approach). Additionally, instead of inheriting v8-juice's huge collection of weirdly-named function-binding templates, clients now need only 3 templates to bind functions (one each for free functions, const- and non-const member functions). The idea of doing a header-only spin-off has been brewing for some time, but i was recently inspired to finally do the work by two other v8-users list members: - James Pike: when i saw how vu8 takes advantage of function-pointer-style template parameters, i just _had_ to have that feature for myself. - Fuzzy Spoon: the separation of const- and non-const member handling was prompted by Fuzzy's report about MSVC not being able to select the proper template specializations when the the member functions differ only in constness. v8::convert is only about 3 nights old, but already has at least as much API documentation as v8 itself. There is an overview and example code here: http://code.google.com/p/v8-juice/wiki/V8Convert The source code is here: http://code.google.com/p/v8-juice/source/browse/#svn/convert It includes a standalone demo application and a demo v8-juice plugin. Happy Hacking! -- ----- stephan beal http://wanderinghorse.net/home/stephan/ -- v8-users mailing list [email protected] http://groups.google.com/group/v8-users
