Version française
Home     About     Download     Resources     Contact us    
Browse thread
csml: high-level bindings between OCaml and .Net
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Alain Frisch <alain.frisch@l...>
Subject: Re: [Caml-list] csml: high-level bindings between OCaml and .Net
Ludovic Coquelle wrote:
> Probably something went wrong somewhere ... I did use PInvoke
> intensively on mono and I never experienced problem (I do not remember
> which version of mono, it was around 2 years ago).

I have absolutely no doubt that P/Invoke does work under Mono. I'm just
saying that I could not make it work in the limited amount of time I
gave to this experiment (the error I got is described in the message to
the Mono mailing-list I was referring to).

> Is it easier to use CSML compare to porting ocaml code to F#?

It depends on how much of .Net you plan to use (and other factors). If 
you talk about porting OCaml code to F#, it probably means you have an 
existing code base that does not require .Net at all now and you want to 
use some features from .Net; in that case, to answer your question, 
using CSML is probably easier than rewriting your whole code base.

F# and OCaml+CSML are really two different things.

With F#, you live in the .Net world entirely: a single GC, no issues
with threads, and the binding between F# and C# is automatic. CSML make 
the two worlds live happily together but they are still two separate worlds.

For situations were both would be appropriate, there are several
arguments to consider.

- As far as I know, F# is significantly slower than OCaml in native code
for symbolic computation (which is precisely the kind of code you would 
like to use ML for).

- F# and OCaml are really two different languages, with their own
features (e.g. the object and module systems are very different) and
tools.

- For people who want to support cross-platform applications, OCaml is 
probably a better option. CSML lets you write the parts of your 
applications that are specific to .Net but the rest of your project 
remains platform-independent.

- For members of the OCaml consortium at least, being able to modify,
embed and redistribute the OCaml compiler is a big plus. (E.g. at 
LexiFi, we rely heavily on substantial extensions to the OCaml system.)

- With CSML, it is possible to have mutually recursive OCaml and C# data
structures and to have a single application that calls back and forth
between the two languages. As far as I know, it is not possible to link
F# and C# code in the same .Net assembly, so some kind of recursions are
more difficult. This is not a problem if you only want to import
existing .Net libraries or to expose your ML code as .Net components,
but for a mixed application, this might be an issue.


Alain