Assignment 2, CSCI 5535

Due date: September 28th 

The Modula-3 programming language has most of the modern "cool" features, such as objects, exception handling, garbage collection, and support for concurrency.  However, unlike other modern languages, such as Java and C#, one of the design goals of Modula-3 was to have a language that would fit entirely in 50-pages.   Thus, despite being rich in features, Modula-3 is a small language, and thus ideally suited for demonstrating programming language concepts in an educational setting.  Modula-3 has had a significant influence on newer languages such as Java and C#.

In this assignment you will read up about Modula-3 and evaluate the language using concepts and criteria that we have been discussing in class.  Before you answer these questions, you should read The Modula-3 Type System.  You will also need to refer to the "types" section of the The Modula-3 Language Definition.  Based on these readings, answer the following questions about Modula-3:

  1. Does Modula-3 support covariant return types for methods?  Explain the reason behind Modula-3's decision?
  2. Modula-3 defines its assignment rules by first defining subtyping rules.  One way of doing this is to simply say:
    "Assignments from a subtype value to a supertype variable is allowed.  All other assignments are disallowed".  The advantage of this is that rule is that all assignments can be type-checked statically.  However, Modula-3 does not adopt the above rule.  Explain Modula-3's exceptions to the rules and speculate the reason for Modula-3's rules.
  3. Give two examples where Modula-3 deviated from the value-set subtyping rule (i.e., subtyping based on subsetting of values) in the interests of efficiency.  Explain why Modula-3 deviates from the value-set rule in these cases. 
  4. Evaluate Modula-3 based on the criteria that Guy Steele discusses in his talk.