caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Joel Reymont <joelr1@gmail.com>
To: Gabriel Scherer <gabriel.scherer@gmail.com>
Cc: Goswin von Brederlow <goswin-v-b@web.de>, caml-list@inria.fr
Subject: Re: [Caml-list] using modules to wrap c++ classes
Date: Thu, 3 May 2012 16:02:38 +0100	[thread overview]
Message-ID: <CAOQwdX3EXJ7fCrtMMTrnExaBMMTagDz_7ycv_JYe5SUHfv4scw@mail.gmail.com> (raw)
In-Reply-To: <CAPFanBGgwsrNXSTO-5vGzoKk3cT=+8dnY9yBeqq0b5FgHW4H-Q@mail.gmail.com>

Gabriel,

On Thu, May 3, 2012 at 3:27 PM, Gabriel Scherer
<gabriel.scherer@gmail.com> wrote:

> (1) You could define, on the C++ side, a generic GenericAdmCallbacks
> class whose constructor would take as parameter a function pointer
> implementing Alert (so the function itself only does the plumbing).

There's another class RCallbacks with scores of Alert-like methods, though.

I didn't count all the methods but I'd say about 50.

Then there's another callback class...

> Then you can expose this class as an OCaml abstract type, and wrap its
> constructor to expose it to OCaml, so that it takes ocaml-land
> callbacks and return the abstract type.

I suppose I can have a static table on the C++ side with pointers to
implemented methods.

> You can then expose to OCaml
> your function manipulating AdmCallbacks (let's call it
> "call_me_later").

I guess I can represent the various callbacks for each class as a
variant on the OCaml side that takes a closure per callback.

I think I prefer your approach to my OOP one.

Thanks Gabriel and thank you Goswin!

--------------------------------------------------------------------------
Working on AlgoKit, a new algorithmic trading platform using Rithmic R|API
---------------------+------------+---------------------------------------
http://wagerlabs.com | @wagerlabs | http://www.linkedin.com/in/joelreymont
---------------------+------------+---------------------------------------

  reply	other threads:[~2012-05-03 15:02 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-03 12:22 Joel Reymont
2012-05-03 13:35 ` Goswin von Brederlow
2012-05-03 13:56   ` Joel Reymont
2012-05-03 14:27     ` Gabriel Scherer
2012-05-03 15:02       ` Joel Reymont [this message]
2012-05-03 18:41         ` Joel Reymont
2012-05-03 19:20           ` Joel Reymont
2012-05-04  8:43           ` Goswin von Brederlow
2012-05-04 17:23             ` Joel Reymont
2012-05-05 12:39               ` Goswin von Brederlow
2012-05-05 14:11                 ` 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=CAOQwdX3EXJ7fCrtMMTrnExaBMMTagDz_7ycv_JYe5SUHfv4scw@mail.gmail.com \
    --to=joelr1@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=gabriel.scherer@gmail.com \
    --cc=goswin-v-b@web.de \
    /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).