Mixing code in different languages (was: Re: Firefox and Moonlight (Mono) "Free Software" Status?)

Colin Walters walters at verbum.org
Sat Jun 7 21:47:31 UTC 2008


On Sat, Jun 7, 2008 at 4:05 PM, Richard W.M. Jones <rjones at redhat.com>
wrote:

Actually I think I stand by my original statement all the more.  Free
> software _doesn't_ offer an alternative.  OK, it's possible to run
> some mixed languages on the JVM.  But it's not practical -- you can't
> practically write a Jython library called by an OCamljava main program
> [substitute your favorite languages here as appropriate].  Mono/.Net
> _is_ the only widely available practical implementation
> (unfortunately).


Ah, I think this discussion started from a misconception then.  As far as I
know, .NET does not easily let you consume arbitrary Python libraries from
OCaml/F#, or vice versa.  I don't see how it would.  The two are wildly
different - Python's object model is "everything is a hash table!", which is
not the same as .NET's object.  The way to think of this is that IronPython
is really its own world on *top* of .NET; just the same for Jython and the
JVM.

Practically speaking in this case too, Python has no facility to declare
types even around interface boundaries, so everything you pass in or out
would have to be represented in OCaml as PythonValue or something, with
methods like get_int(), get_attribute()...yuck!

More generally the goal of .NET was not to somehow automagically make any
arbitrary (particularly non-native as defined before) language X be able to
use any language Y easily.  The goal is more practical - sharing a garbage
collector, JIT, and standard library.  This enables a pattern where the core
is programmed in the native system language (Java/C#), but those libraries
can be consumed by other languages, for scripting, DSLs, templating, etc.

And that's the exact same thing the JVM provides, and really that the
bytecode/JVM model has provided for over a decade.   Don't get me wrong,
.NET added a few things like tuples and continuations, but the two systems
are much closer than they are different; the main differentiator in my
opinion has mostly just been marketing (which is admittedly very
important).

This is a good blog entry on this model:
http://ola-bini.blogspot.com/2008/06/fractal-programming.html

This is a serious question.  Certain groups of users I've talkd to
> like OCaml, but don't want to write whole programs in OCaml (or want
> to use their existing libraries with it).  Unfortunately for everyone
> F# is being seen as a practical solution to their problem, which means
> they're locked into a proprietary language on a proprietary operating
> system.


Sure.  That was the motivating factor behind OCamlJava it appears from the
web page.

But again, there is no magic cross-language anything-can-call-anything now
or in the future, and if you thought .NET provided that I believe you've
been oversold.

The forseeable future is multi-runtime.  .NET and the JVM are both very
widely deployed at this point and are key to major operating system
vendors.  CPython in particular is going to be around a long time; its age,
liberal licensing, low barrier to entry, and ease of binding to C have made
it pervasive.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/fedora-devel-list/attachments/20080607/409f23c0/attachment.htm>


More information about the fedora-devel-list mailing list