I wrote:
> >"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."
and William Clodius wrote:
> 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.
I didn't claim that inheritance is a substitute for genericity, just
that inheritance will solve the problem of a general linked-list,
including a list of mixed types.
The type system for object oriented programming in Fortran 2002, which
is still undergoing some refinement, is more closely modelled on the
type system of Ada-95 than on the type system of Eiffel. There are
some deficiencies of the imitation of Ada-95 types in Fortran; some
are correctable (but there are no plans to do so), and some are not,
except by substantial change that could not be done in a way that
retains compatibility to existing programs.
Best regards,
Van Snyder
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|