Presentation is loading. Please wait.

Presentation is loading. Please wait.

Standard ML- Part II Compiler Baojian Hua

Similar presentations


Presentation on theme: "Standard ML- Part II Compiler Baojian Hua"— Presentation transcript:

1 Standard ML- Part II Compiler Baojian Hua bjhua@ustc.edu.cn

2 Recap SML core language declaration expression function data types exception Today, module system

3 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

4 SML Module System Signature “type” or “interface” of a structure Structure module body Functor parameterized structure (or structure function)

5 Signature Interface to describe a module General form: signature ID = sig specifications end

6 Structure The concrete implementation General form structure Id = struct declarations end

7 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

8 Functor Module-level functions make module parameterized See the accompanying code

9 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

10 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


Download ppt "Standard ML- Part II Compiler Baojian Hua"

Similar presentations


Ads by Google