Standard ML- Part II Compiler Baojian Hua
Recap SML core language declaration expression function data types exception Today, module system
Module System Language features to organize large (even small) software projects A well-design module system makes small pieces separately easy to write wholly easy to combine interface and implementation clearly separated In my opinion, the most important feature in any serious language pay special attention to modularize your programs
SML Module System Signature “type” or “interface” of a structure Structure module body Functor parameterized structure (or structure function)
Signature Interface to describe a module General form: signature ID = sig specifications end
Structure The concrete implementation General form structure Id = struct declarations end
Ascription Two forms of ascriptions: transparent opaque Either with pros and cons, and it ’ s of great importance to choose apporiate one See the accompanying code
Functor Module-level functions make module parameterized See the accompanying code
Module Language SML module combines elegantly the concept of interface, implementation and parameterization signature structure functor So far, the most interesting and powerful module system in language design
Summary Learning to program in SML can be tricky at first But once you get used to it, you will never want to go back to imperative languages Check out the reference materials listed on the course homepage, do reading and practicing