next up previous contents
Next: MLton.Cont Up: MLton Previous: MLton   Contents

MLton

debug

a compile-time constant that is true when compiling -DMLton_debug=1 and false when compiling -DMLton_debug=0. The default is false.

isMLton

always true in a MLton basis library.

safe

a compile time constant that makes it easy to include assertions and checks in code that you would like removed when running at full speed. safe will be true unless the program is compiled with the -safe false option, in which case it will be false. The simplification passes of the compiler will remove any uses of safe at compile time. For example, array subscripting might be implemented as:
fun sub (a, i) =
   if MLton.safe andalso (i < 0 orelse i >= length a)
      then raise Subscript
   else unsafeSub (a, i)
When compiled -safe false, sub will reduce to unsafeSub.

size x

return the amount of heap space (in bytes) taken by the value of x. Size takes time proportional to the size of its argument. For an example, see examples/size.sml.