Hi Evan
Early on in the project we actually had both a C and a C++ api but the
C api was dropped during a rewrite.  I don't think we'd want to add a
new C api to v8.  We don't have a use for it ourselves and so it would
inevitably be less well tested and maintained than the C++ api -- as
indeed was the case with our old C api.

Your approach seems reasonable but there are many ways to map the C++
abstractions we use to C, and finding the right approach will probably
take some experimentation.  Our old C api didn't have a handle
abstraction, for instance.  Instead of a Handle<Object> you would use
a V8Object*, and there was no distinction between the operations that
acted on the handle and on the object itself.  Representing the
distinction between handles and the objects contained in handles is
difficult in C if you also want to use the type system to track which
type of object is stored in handles.

As for the v8.h changes, having #ifdef
<option_specific_to_another_library> is something we want to avoid,
but in this case for instance the ability to create handle scopes that
are not stack-allocated might be useful in other contexts so we might
consider adding that in some form.  As long as it's functionality that
is generally useful and not tied to a particular library we'll
consider adding it.


-- Christian

On Thu, Oct 2, 2008 at 6:03 AM, Evan Martin <[EMAIL PROTECTED]> wrote:
>
> The v8 C++ API is quite nice!  But to use v8 from within other
> languages, it would be useful to have C bindings, as most languages
> can bind against C but not C++.
>
> Here's a patch that provides enough API for me to write a simple
> expression evaluator in Haskell:
> http://codereview.chromium.org/6070
>
> My main questions:
> 1) Are you interested in getting something this into the v8
> repository, or should I maintain it separately?
> 2) Am I going about this the right way?  In particular I didn't want
> to change v8.h but I'm not sure there's another option.
>
> >
>

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

Reply via email to