On Thu, Jul 21, 2005 at 03:21:08AM +0900, Jim Freeze wrote: > > I looked at ocaml a while back, but stopped when I didn't see > an easy way to call ocaml routines from Ruby. > I think it would be very nice if I could write extensions in > ocaml instead of C. > > Granted, I didn't spend any time investigating this, so I'm > asking here, has anyone written an extension in ocaml for Ruby? > I would like to know what compiler was used and what > options were used. > > -- > Jim Freeze It would be difficult to do. Ruby libraries expect a 'C' style interface. While OCaml can also easily interface to 'C' style libraries, it can't create them. Another approach would be to embed the OCaml runtime in Ruby which would allow it to load compiled OCaml libraries. Working out the call interface between OCaml functors and Ruby methods would be interesting. OCaml is designed to be easily callable from C so this certainly should be possible. Before someone asks the question, OCaml has a runtime because it is a garbage collected langauge so a small kernel needs to be available when an OCaml program is running. The program can be either compiled to bytecode (not so different than Ruby) or to machine code (this is what's interesting to me). Ruby could also be embedded in OCaml... I think that would probably be easier but not as useful. Rick -- Rick Nooner rick / nooner.net http://www.nooner.net