Gabriel,

On Thu, May 3, 2012 at 3:27 PM, Gabriel Scherer
<gabriel.sche...@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
---------------------+------------+---------------------------------------

-- 
Caml-list mailing list.  Subscription management and archives:
https://sympa-roc.inria.fr/wws/info/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

Reply via email to