(**** * * Yet one more test of union projection/injection. I don't remember right now * the Tennet def of these terms, but in seems to me that injection means take * a union component type and turn it into (i.e., inject it into) the union * type, whereas projection means take a union type and "project out" to one of * its component types. By these defs, injection is automatic whereas * projection must be done explicitly via the '.' union op (or .< instance * extraction op). It would seem that this scheme of automatic injection but * non-automatic projection is consistent with polymorphic value binding, where * injection, i.e., binding a sub-class value to a parent-class type, is * automatic, whereas projection, i.e., binding a parent-class value to a * sub-class type, requires a down-cast (cf. ./PolymorphismCheck.java). * *) obj U = i:integer or s:string; op Op(U, integer)->U; op main(u:U, i:integer) = ( Op(u, i); -- obviously fine Op(i, i); -- OK via union analog of polymorphism rule Op(u, u); -- ERROR, again via union analog of polymorphism rule Op(u, u.i); -- OK via explicit projection (i.e., down-casting) );