Thanks, Malcolm, for those helpful suggestions, some of which I hadn't
thought of; but I think these, as well as my own ideas, are all better
described as "work arounds" rather than solutions.
On Tue, 22 Aug 2000, Malcolm Cohen wrote:
> Moreover, string length is not generally known at compile-time, so the
> compiler would not know which routine to call anyway!
Yes, using the word "generally" in the strict mathematician's sense, but
length is known at compile-time in many actual cases. Indeed your own
compiler (NAG f95) diagnoses an error at compile-time when the actual
argument of a procedure is shorter than the dummy one and the interface is
explicit (though it does not even seem to issue a warning when it is the
other way around).
> You could use the allocatable components version, which does not suffer
> from these memory leaks.
I presume that this only works with a compiler with f2k extensions?
It seems to me that Fortran as currently defined has a string type which
is unfortunately semi-dynamic: if all string lengths were fixed at
compile-time then one could indeed use them as a procedure disambiguator,
on the other hand if they were fully dynamic then one would not need to
disambiguate procedures on length at all. As it is, there doesn't seem to
be a good solution.
Regards
--
Clive Page,
Dept of Physics & Astronomy,
University of Leicester.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|