On Tue, Apr 16, 2013 at 03:12:38PM +0200, Miloslav Trmač wrote:
On Mon, Apr 15, 2013 at 11:19 PM, Richard W.M. Jones
<rjones(a)redhat.com>wrote:
> On Mon, Apr 15, 2013 at 06:48:32PM +0200, Miloslav Trmač wrote:
> > Now, what to move to? I currently don't have see any language/runtime I
> > could recommend, which is in itself rather frightening.
>
> Ada, Eiffel, Go, Coq + OCaml, Erlang, Haskell, CompCert[*], etc. etc.
>
> All these languages are viable.
Perhaps for end-user applications[1], but not for libraries/code
reuse/implementing platform interfaces to be usable by applications. How
do I call an Eiffel library from Ada and pass it a callback written in Go?
The answer (perhaps sadly) is you have to expose a C API. At least
OCaml and golang can generate C-compatible shared libraries. Probably
Eiffel and Ada too, although I'm not certain on the details.
Passing pointers to objects from one language to another is likely
*not* possible however. And it gets hard when you want to mix lots of
languages (because GCs won't cooperate with each other).
.Net does this right, although requiring a heavyweight VM to do it is
probably not necessary.
[1] To take a random set of examples, how many of these languages
have
libraries or bindings for (all of) TLS, good i18n, libselinux, readline,
D-Bus, GTK?
OCaml has 3/6. Having an easy to use FFI helps a lot here. The OCaml
code in libguestfs uses a number of different C APIs, and mostly I've
just hand-written snippets of FFI to do it. It's not a lot of code,
although not ideal.
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
Read my programming blog:
http://rwmj.wordpress.com
Fedora now supports 80 OCaml packages (the OPEN alternative to F#)