Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: beo wulf <beowulf@intamp.com>
To: Guillaume Yziquel <guillaume.yziquel@citycable.ch>,
	caml-list@yquem.inria.fr
Subject: Re: [Caml-list] boostbind/pythonbind/luabind for ocaml?
Date: Mon, 17 Jan 2011 04:00:05 -0800	[thread overview]
Message-ID: <AANLkTi=VBRLsTxBUtBPWqJNrSU5pXV6pKf9S29AM_HNv@mail.gmail.com> (raw)
In-Reply-To: <20110117111304.GV4195@localhost>

> Le Monday 17 Jan 2011 à 02:19:39 (-0800), beo wulf a écrit :
>> Hi!
>>
>>   Is there anything like luabind or pythonbind for Ocaml? Basically, it's
>> http://www.rasterbar.com/products/luabind/docs.html#hello-world
>>   a really convenient way to bind class member / functions to another language.
>
> For Python, there are PyCaml and my own stuff. PyCaml is the most
> supported, as long as you take Thomas Fischbacher's version and not the
> outdated version from Art Yerkes.

I explained poorly. I don't want to bind lua or python to Ocaml. I
want to bind C++ to ocaml.


> For C, I'd suggest using encapsulate.macro.c from my OCaml-StdC. For
> C++, things are somewhat awkward. I've made a tentative binding to Boost
> stuff, but not really usable. The biggest issue is that C++ is more
> static when it comes to templates than OCaml, and OCaml is not dynamic
> enough as Python to cope for C++'s staticness.

Can you expand on C++'s staticness, and why OCaml is not dynamic enough for it?

Luabind can't bind entire templates -- it can only bind instances of
templates. I'm perfectly happy accepting this lmitation, i.e. having
to have separte:

std::vector<int>
std::vector<Foo>
std::vector<Dog>


> So for C++, you're almost better off making your bindings yourself.

Binding a piece of code from C++ to anotehr langauge involves 3 steps
(1) template magic to get the type of the member/function
(2) some sort of reference counting
(3) generating the code for the binding

(1) & (2) is already provided by pythonbind/luabind/slb
The question is (3) ... which I think can be automated once.

>
> And BTW, my codes do not work anymore because I've made big underlying
> changes that I haven't found the time to push forward.
>
> In a nutshell, for C++, it's hand-crafted. For Python, there's PyCaml.
>
> --
>     Guillaume Yziquel
> http://yziquel.homelinux.org
>


  parent reply	other threads:[~2011-01-17 12:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-17 10:19 beo wulf
2011-01-17 10:53 ` [Caml-list] " Sylvain Le Gall
     [not found] ` <20110117111304.GV4195@localhost>
2011-01-17 12:00   ` beo wulf [this message]
2011-01-17 12:57     ` [Caml-list] " Guillaume Yziquel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='AANLkTi=VBRLsTxBUtBPWqJNrSU5pXV6pKf9S29AM_HNv@mail.gmail.com' \
    --to=beowulf@intamp.com \
    --cc=caml-list@yquem.inria.fr \
    --cc=guillaume.yziquel@citycable.ch \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox