Whole-program optimization is a compilation technique in which optimizations operate over the entire program. This allows the compiler many optimization opportunities that are not available when analyzing modules separately (as with separate compilation). Most of MLton's optimizations are whole-program optimizations. Because MLton compiles the whole program at once, it can perform optimization across module boundaries. As a consequence, MLton often reduces or eliminates the run-time penalty that arises with separate compilation of SML features such as functors, modules, polymorphism, and higher-order functions. MLton takes advantage of having the entire program to perform transformations such as: defunctorization, monomorphisation, higher-order control-flow analysis, inlining, unboxing, argument flattening, redundant-argument removal, constant folding, and representation selection. Whole-program compilation is an integral part of the design of MLton and is not likely to change.
* supports for all of Standard ML, including modules, pattern matching, higher-order functions, generative exceptions, etc. * Standard ML Basis Library support * SMLtoJs supports calling JS functions and for executing plain JS. Standard ML functions may be exported and called by JavaScript code. * Simple DOM access. Simple DOM access and support for installing Standard ML functions as DOM event handlers and timer call back functions. * Optimization. All Standard ML module language constructs, including functors, functor applications, and signature constraints, are eliminated at compile time. SMLtoJs performs a series of compile time optimizations, so it generates fairly efficient JS code * Reactive Web Programming. SMLtoJs has library support for Reactive Web Programming. See the rwp_ex1 example. The simple library API captures the basic notions of behaviors and event streams as well as the concepts of behavior transformers and event stream transformers.