caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jacques Garrigue <garrigue@math.nagoya-u.ac.jp>
To: Joel Reymont <joelr1@gmail.com>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] c++ class to ocaml class or module?
Date: Wed, 29 Dec 2010 09:11:49 +0900	[thread overview]
Message-ID: <825BF6CA-5158-4669-BB57-FE751CBC5479@math.nagoya-u.ac.jp> (raw)
In-Reply-To: <EEDCA6F3-63E3-4803-88E7-963B6821D297@gmail.com>

On 2010/12/29, at 8:26, Joel Reymont wrote:
>> I would only suggest making the extra effort of combining these
>> functions into classes if sutyping is actively used.
> 
> This is a large surface C++ API where I need to subclass to provide callbacks.
> 
> For example, the initialization arguments to the "engine" class are grouped into a "parameters" class so I need to create the parameters object in C++ and then individually set the members. 

As this doesn't seem to involve subtyping, I would suggest just
putting your parameters into an ocaml record, and have a class on the
C++ side that accesses the fields of such a record.
Keep the FFI as simple as possible.
If you need more structure on the ocaml side, you can always add it later.

Jacques Garrigue

  reply	other threads:[~2010-12-29  0:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-28 23:15 Jacques Garrigue
2010-12-28 23:26 ` Joel Reymont
2010-12-29  0:11   ` Jacques Garrigue [this message]
  -- strict thread matches above, loose matches on Subject: below --
2010-12-28 21:34 Joel Reymont

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=825BF6CA-5158-4669-BB57-FE751CBC5479@math.nagoya-u.ac.jp \
    --to=garrigue@math.nagoya-u.ac.jp \
    --cc=caml-list@yquem.inria.fr \
    --cc=joelr1@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).