obj Elem; obj GenericList = elems:Elem*; obj IntList < GenericList where: Elem = integer; end IntList; op f(l:IntList, i:integer, e:Elem)->boolean = ( l.elems[1] = e; (* ERROR. This does not work because e:Elem > integer, * and due to generic instantiation, the type of * l.elems[1] is integer. *) e = l.elems[1]; (* ERROR. Ditto. *) l.elems[1] = i; (* This should work, but it does not in RSL versions * that do not implement where instantiation. *) l[1] = i; (* !! Wont work, because IntList is of type (integer* and) * NOT of type integer*. Oops -- this aint so nice. * UPDATE here: Maybe this should work since IntList should * still be a one-tuple. * FURTHER UPDATE: yes, in fact this should now work with * one-tuple compat. It will still fail in pre-where * implementations, with a message of the form * Incompatible operand types in an equality expr. * This happens because without actual generic instantiation, l * is still seen as type Elem*. Note, however, that with * one-tuple compat, the failure on this expr is no longer * because l is not of type list, as originally stated in the * "Wont work" sentence at the start of this comment. *) true );