[MLton] Porting MLton... C99?

Stephen Weeks MLton@mlton.org
Thu, 9 Dec 2004 19:11:35 -0800


> Why did you guys put pointers in ints?
> And why did you define unsigned long as W32?

I wrote the original runtime on x86 a long time ago (1998) with nary a
thought of portability.  It has grown since then, but we've never gone
back and cleaned it up.

> All those printf("%08x", (uint)ptr); lines scattered everywhere are also a
> problem. The best way to do this is to change it to printf("%08lx",
> (ulong)z), no matter what type z is. When using uintX_t you have no idea
> what that corresponds to in a format string so upgrading to the largest
> portable formatted type is the best approach.

I agree with the principle.  But wouldn't using long long be better
than long?

> So, I am going to start over, use <stdint.h>, and upgrade everything to C99.
> Then I will systematicly walk through gc.{ch} and change the types one at a
> time. Once I have it working again on linux+i386 with corrected types and
> portable float methods, I'll try ia64 again.

This sounds fabulous.  You might want to wait a day or two before
starting, as I am in the middle of tweaking the compiler and runtime
to support UCS2 and UCS4 string constants.


Also, one thing I should confirm with you before you start making
substantial runtime modifications.  MLton is currently released under
the GPL.  Because MLton-generated executables are linked with the
runtime, this means that they are infected with the GPL.  We've been
meaning to change this for some time (over a year), but haven't gotten
to it.  The plan is to go to a less restrictive license that allows
people to use MLton without having to GPL their executable.  I just
wanted to make sure you're OK with the less restrictive license
vis-a-vis your contributions.  Sorry for not bringing this up sooner
-- we plan to clean up the whole licensing situation in the next
couple months, and get stuff up on the wiki explaining the situation.