Restrict types mail
These two emails are from the ECMA mailinglist and written by Bertrand Meyer. Only the important parts are copied:
First mail
Restrict_list == restrict Interval_expression Interval_expression == Interval | "{" Interval Operator Interval "}" Interval == Explicit_interval | Implicit_Interval Explicit_interval == Class_type ".." Class_type Implicit_interval == Class_type | ">" Class_type | Class_type ">" Interval_operator == "+" | "-" | "*" Note that operators use full parenthesization so there is no ambiguity. Maybe parentheses would be better than braces. Instead of >T and T> we could use .. T and T .., i.e. allow omitting either but not both of the two Class_type in Explicit_interval. Having played with both I tend to like the ">" forms better but am not really sure. Semantics: An Interval_expression denotes a (possibly empty) subset of the types in the universe. T .. U is the set of all types that conform to T and to which U conforms. T is an abbreviation for T .. T. T> is an abbreviation for T .. NONE. >T is an abbreviation for ANY .. T. "+" is union, "-" set difference, "*" intersection. Examples: ANY .. NONE -- Fits all types ANY> -- Means the same >NONE -- Means the same T> -- T and conforming types >T -- Types conforming to T T .. U -- Types conforming to T and to which U conforms X .. Y -- Types conforming to X and to which Y conforms {T .. U} + {X .. Y} -- Types that satisfy any of the preceding two conditions {T .. U} - {X .. Y} -- Types that satisfy the first of those but not the second {T .. U} * {X .. Y} -- Types that satisfy both etc. a: T is an abbreviation for e.g. a: restrict {T>}. Comparison with last proposed notation: a1: ANIMAL restrict ANIMAL -- Previously accept {ANIMAL}: monomorphic a2: ANIMAL restrict ANIMAL> -- `restrict' clause is superfluous a3: ANIMAL restrict {ANIMAL> - ANIMAL} -- Strictly polymorphic. a4: ANIMAL restrict OCTOPUS> -- Previously accept {all OCTOPUS} a5: ANIMAL restrict {CAT> + OCTOPUS} -- Previously accept {all CAT, OCTOPUS} a6: ANIMAL restrict {ANIMAL> - CAT>} -- Previously reject {CAT} a7: ANIMAL restrict {FELINE> - {CAT .. SIAMESE}} -- No previous equivalent I don't have any good example with intersection.
Second mail contained conformance rule
T restrict S conforms to T restrict S' only if S is a subset of S'