[MLton] Debian: sparc works
Wed, 22 Dec 2004 16:04:35 -0800
> Not every system supports all the rounding modes.
> When FE_DOWNWARD, FE_TONEAREST, FE_TOWARDZERO, or FE_UPWARD is defined that
> means the platform supports that mode. If it is not defined, then this mode
> does not exist... Your use of _constant will lead to constants.c failing to
> compile on less able platforms.
One solution is to put appropriate #defines in platform/<os>.h to make
undefined constants, say, -1, and to put a test for them in
IEEEReal.sml so that setRoundingMode raises an exception on such
> How nasty would it be to make every C type needed by the runtime a
> primitive type in MLton? I don't mean user visible, just in the
> primitive.sml stuff...
Why does the compiler need to know about these types, i.e. why should
they be primitive? It seems better to keep the compiler simple and to
put the knowledge elsewhere, e.g. as type synonyms in a prelude :-).
structure Uid:> sig type t end =
type t = int32 (* or whatever *)
> If C's pid_t, uid_t, int, long, short, char, etc were all available
> to the basis library, that would be ideal. As long as the C FFI
> supported it, we could copy the C prototype straight into SML.
Right. That was the intention with my proposal. In fact, it's kind
of what we did (see all the type synonyms in posix/primitive.sml),
except we didn't use opaque signatures to make things safe (the FFI
only recently supported opaque types) and didn't put in support for
> The SML types int, real, char would be decoupled completely from C
> types of similar name.
> How to pick SML's int and real is something I am less sure about.
> SML int != C int; linux+C made int=32bit even on 64bit machines because of
> legacy code. SML doesn't have this problem so we should get it right: 64bit.
That seems fine. Also, if we're going to go to the work to make the
basis library more portable and be able to handle basic types being of
different sizes, dependent on platform, we might as well go that extra
bit and add a compiler switch to control what size Int is. That way,
if space or legacy code is important, it is easy for a programmer to
choose Int = Int32 on Alpha.