----- Original Message -----
From: "Michael Milgram" <[log in to unmask]>
To: <[log in to unmask]>
Sent: Tuesday, January 29, 2002 2:00 AM
Subject: mixed TYPES and OVERLOADING
> 1. Can you create a linked list of different types?
>
> 2. How do you use OVERLOADING to process the list after it has
> been created, without introducing an "IF-THEN-ELSE" construct somewhere?
>
> If it can't be done, what is the purpose of TYPE overloading anyway,
> since the
> language doesn't allow subroutine references to different TYPES in a
> generic sense?
There have been other replies to point 1. Note also the article on building
a generic list-handling facility in the April 2001 issue of ACM Fortran
Forum.
The main motivation for the overload feature was to enable generic
interfaces for user-written procedures, in the same way as they became
available, in Fortran 77, for intrinsic functions. This is just what you
have in your code, although it would be more usual to place the two specific
print routines directly in the module and specify the generic interface with
a MODULE PROCEDURE statement ("Fortran 90/95 Expained", Section 5.18). (A
similar mechanism is also used for operator overloading.) Fortran 95 does
not support object-oriented programmining as such. That is planned for the
next revision, due in 2004.
Regards,
Mike Metcalf
|