[MLton] Porting problems

Ville Laurikari ville@laurikari.net
Fri, 14 Apr 2006 12:25:15 +0300

On Thu, Apr 13, 2006 at 01:59:21PM -0700, Stephen Weeks wrote:
> Did you make the MLton.OS.Platform.t change to all of the following?
>   basis-library/misc/primitive.sml
>   basis-library/mlton/platform.sml
>   bin/upgrade-basis 
>   lib/mlton-stubs/mlton.sml

I have now figured it out, and can continue with the porting work.

It turned out to be a misunderstanding of what the various mappings
from strings and datatypes are doing.  At first glance, it seemed like
there were three kinds of names for operating systems:

  1. Human readable names, like "Linux", or "HP-UX", represented by
     string values in MLton.
  2. Platform identifier strings, like "linux" or "hpux", used
     in the various scripts and files to refer to an OS.
  3. The name used in SML code in the MLton.Platform.OS.t datatype,
     such as `Linux' or `HPUX'.

There seemed to be mappings from 2->3 in
basis-library/misc/primitive.sml and 3->1 in other places.  But, after
reading the code a bit, I realized that names in category 1 should be
such that they can be converted to names in category 2 by converting
them lower case.  

So, I fixed my "HP-UX" strings to "HPUX" and now it works...  I had
originally used "HP-UX" since that is the official name of the OS, not

It might be a good idea to try to gather up all platform names,
identifiers, and the code which does the mappings between them into
one place.  And document the fact that the names must match when
converted to lower case.

Thanks for your help!