Re: Subject reduction fails in Java - Part 2

The fact that in Java, types with upper bounds do not have least upper bounds
seems to be yet another argument for the use of structural subtyping rather
than "by declaration" subtyping in OO languages.  

Those looking at adding bounded polymorphism to Java have already run into 
difficulties with "by declaration" subtyping when the bound for a polymorphic
function is defined after the classes you wish to instantiate it with.
This is a particular problem with Java because you are not allowed to declare
an "extends" or "implements" relation after the class has been defined.

Interestingly, one of the claimed advantages of using "where" clauses rather
than bounded polymorphism is that this problem no longer exists, but of course
it is really an argument for structural subtyping (though I'm not sure the
where clause proponents would accept this).

The argument for "by declaration" subtyping is that it catches errors that
might otherwise slip by (e.g. an accidental subtyping of a graphics class
with a "draw" method and a cowboy class with a "draw" method), but has anyone
ever run into such a problem in real life?

I'd be interested in hearing if anyone feels there are strong advantages
to "by declaration" subtyping versus structural subtyping.

	Kim Bruce