[MLton] Windows ports and paths

Stephen Weeks MLton@mlton.org
Sun, 1 May 2005 01:37:42 -0700


> So, I tried rebuilding cygwin today and found that the C99 support there is
> a bit broken. For whatever reason, several functions and structures get
> turned off when compiled with -std=c99. An easy fix is to use -std=gnu99
> instead. That's still C99, but with the GNU functions also.
>
> A patch, fix-cygwin.patch is attached (it also fixes a buggy mingw setenv).

Thanks for the patch.  I committed all the c99-->gnu99 changes.  I
didn't commit the change from "-mcpu=pentiumpro" to
"-march=pentiumpro", because I'm not sure what our position is on
generating specialized code that doesn't run on some archs.  Anyone
else have any thoughts?

> The big problem I had is the question about what isAbs should return
> for "\".

The basis library spec is clear that in the Windows world "\" is
absolute.  I realize that MinGW <> Windows, so there is some wiggle
room.

> The second, slash_is_absolute.patch considers "\" to be absolute
> and "E:\" simply the same as "\" with a volume.

I've checked in this one for now.  If we want to go the other way,
it's worth discussing with the basis library designers and other SML
implementors by sending an email to sml-basis-discuss@cs.uchicago.edu.

> I did a double-check of the patch under linux, and there is a small
> regression in unixPath.sml, but I think the old behaviour was wrong:
> joinDirFile {dir = "/c/a/b", file = ""} should be "/c/a/b" afaics.
> -- the new concat was taken directly from the standard...

I agree that concat should do as you say, but I am not so sure for
joinDirFile.  Looking at just the wording for joinDirFile in the spec,
it's not clear what the right answer is.  However, looking also at
splitDirFile shows us that

	splitDirFile "b/" = {dir = "b", file = ""}

which fits well with

	joinDirFile {dir = "b", file = ""} = "b/"

which makes it seem that the old behavior was correct.  I'll also
point out that every SML implementation except for Hamlet does it like
MLton.  Based on past experience, this probably means that every
implementation except for Hamlet is wrong :-).  Andreas, any thoughts?