4.3 Matching Against Type Patterns
if theconcrete objectstrangeisacollection[int], collection[string];
strange object is sent the do message, its type will be matched against the type pattern collection['T]. Both collection[int] and collection[string] will match, but the system needs to locate a single type to bind to the variable T. Binding T to int&string might seem reasonable, but then a type error will result, because strange is not a subtype of collection[int&string] (such a relationship would have to be explicitly declared). To avoid this sort of problem at method invocation time, objects like strange are disallowed.For an object declaration to be legal, there must be at most one most-specific instantiation for any of its parameterized supertypes. This check is made when type-checking an object declaration or constructor expression.
Generated with Harlequin WebMaker