OS.FileSys on Win32...

Stephen Weeks MLton@sourcelight.com
Fri, 15 Jun 2001 07:07:13 -0700


> But how would you like the implmentation of these
> Win32 specific changes (problem 2) and 3) ) to be done
> in the MLton code? I know that you would like to keep
> it as easily portable as possible... :)

Here are the options that I see.

1. Have OS specific stuff in C code, transparent to the basis library
   implementation.  You did this for solution 1.
  
2. Have OS specific stuff in SML code, and use compile time SML constants and 
   "if" statements to do the right thing.

3. Have OS specific stuff in SML code, and use different files for different 
   OS'es.

Solution 3 is what SML/NJ does and I think it is the right one.  They have
different implementations of OS.FileSys for different OS'es.  They use functors
to express stuff that can be shared.

Here are two different ways to implement this with MLton:

1. Have a different preprocessed version of the basis library for each target OS.
   Specify via a compiler switch which to use.

2. Have a different world.mlton for each target OS.
   Each world is specified by a different src/basis-library/build-basis file.
   Specify to the script that starts MLton which world to use.

Option 2 seems easier to manage to me, and could even be implemented without
changing the compiler proper, by simply switching build-basis and making the
world twice.