[MLton] Re: [MLton-commit] r4677
Matthew Fluet
fluet@cs.cornell.edu
Thu, 6 Jul 2006 09:30:56 -0400 (EDT)
> Fixed profiling, which didn't work on any platform. There was a
> mismatch between the C prototype for GC_profileWrite, which expected a
> FILE* and the SML imported type, which expected a file descriptor. I
> went ahead and changed GC_profileWrite to be more like GC_saveWorld
> and take a file name (as a string) and did the fopen and fclose in
> GC_profileWrite.
>
> This problem would have been caught statically if we used something
> like basis-ffi.def + gen-basis-ffi for the runtime imports (like
> GC_profileWrite) besides the basis). Should we just add stuff in
> basis-ffi.def, should we create another file, or should we leave
> things alone?
In the long run, it might be best to add the GC specific runtime imports
to an auto-generated file. There are two reasons that it wasn't done
originally. 1) I worked on the GC before turning to the C side of the
basis library; I added basis-ffi.def when faced with the larger amount of
code needed to be kept in sync. 2) Even after adding basis-ffi.def, I
felt that some structures, particularly MLton.* structures, would be more
confusing when spread over two files. Something like MLton.Thread.* mixes
a lot of _prim and _import expressions, so it just seemed harder to
maintain.