Jean Vezina wrote:
><snip>
>
>Mr. Van Snyder has sent to me a posting concerning the future object
>oriented features of Fortran 2002 (also referred to F-II) and the
>inheritance and polymorphism features of the language will provide
>a capability close to this. Thus, these new features will solve the
>problem. Here is a transcript of the message:
>
>"Although orthogonal to genericity, object-oriented programming features
>are on the list for Fortran 2002 (F-II), and, again, though orthogonal
>to genericity, would solve the problem of creating linked lists of
>arbitrary structures: Simply create a "base" type with a data type
>consisting of a "pointer to next" and operations to insert, delete,
>etc. Then, extend that type for others. The list operations will be
>inherited for the extending types. Polymorphic pointers will allow
>lists of mixed types."
>
>I think that this new information closes the debate in a very
>satisfactory manner.
><snip>
Two points:
First: I believe that this means of implementing generics is not type safe.
Doesn't this ultimately rely on covariance of arguments? Covariance is used
in Eiffel, a language initially developed around 1985, an a famous paper in
1988 showed that covariance was not type safe. Note that in Eiffel this
lack of type safety is not often a problem, but the designer of Eiffel
found it usefull to include generics partly as a way of limiting this
problem.
Second, the semantics of generics and inheritence are sufficiently
different that compilers will have to work hard to properly optimize
inheritence used in this fashion.
William B. Clodius Phone: (505) 665-9370
Los Alamos Natl. Lab., NIS-2 FAX: (505) 667-3815
PO Box 1663, MS-C323 Group Off.: 505/667-3422 or 667-5127
Los Alamos, NM 87545 email: [log in to unmask]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|