[MLton-user] replacing python in Fedora

Christopher Cramer tsuyoshi at yumegakanau.org
Tue Mar 1 18:04:19 PST 2011


On Tue, Mar 01, 2011 at 10:41:08PM +0100, Gergely Buday wrote:
> Some suggested OCaml for a replacement of python, but got this
> response from a Fedora board member:
> 
> > ... Or take the opportunity to jump to a safe language .. we've
> > already got an OCaml cross-compiler.
> 
> Yes, let's move to something 'safer', which doesn't have ABI compatibility
> ANYWHERE. That makes perfect sense.
> 
> I am no ABI expert so ask you: could mlton do that?

It's hard to say without better specification of what he means by "ABI".

It could be that he's referring to the fact that OCaml libraries compiled
with one version of the compiler will not link with libraries compiled
with a different version. MLton does not do separate compilation so there
is no linking at all (that is to say, MLton compiles the entire program
from source every single time), other than the dynamic linking to the
standard C library etc. that takes place when you run any executable.

If you make a library to link with other languages, using the foreign
function interface and compiling to a regular shared library...
both OCaml and MLton obviously follow the system ABI for this, or it
wouldn't work. I have found that this sort of thing is easier with MLton
than in any other language implementation I've used (aside from C).

> And, would mlton do a better job on memory than python does?

Last I checked, Python still used reference counting, which is very
error-prone. So yes, MLton would do a better job in terms of memory leaks,
although I don't think it is totally immune to them. Aside from memory
leaks, a program compiled with MLton will generally use a little more
than the equivalent program written in C, which should be far superior
to the equivalent Python program.

But I think these complaints about memory usage when comparing different
languages are usually off base. Programs written in C generally use
more memory than programs written in assembly. But so what? We have
more memory now and writing everything in assembly (like we used to do,
long ago) would be a pain in the ass.

BTW Red Hat does use OCaml for some things. I don't know for sure
but it doesn't seem like they have any language mandates there.




More information about the MLton-user mailing list