Dear Dan Nagle and others.
I was programing away just now, and felt unsatisfied by a habit I have got into
to try and keep track of variables in module procedures obtained by host
association.
My habit is to keep a commented list in each module procedure of all variables I
think are being obtained by host association and either `used and changed' or
`used and unchanged'.
A problem with host association as I see it, is that if my commented list is
wrong and that I have accidentally changed or used a host associated variable
there is no way of a compiler picking this up and generating an error. (An
exception is the case where the module procedure is PURE, and you change a host
associated variable.)
I don't know if any move has been made to address this issue with Fortran 2000,
but if not, can I suggest something like the following for some future version
of fortran:
USE HOST, NONE
to say you don't want to obtain any variables by host association
USE HOST, ONLY : [local_name =>] host_name, ...
as with modules, but for host associated variables, and
USE HOST
to do the default which is to leave all variables available for host
association.
Even better would be the inclusion of an additional attribute that could be
added to the above syntax would serve a similar purpose to that of the INTENT
attribute. It could indicate whether you want to allow this variable to be
changed by the module procedure or not.
This would make debugging host association problems far simpler.
Cheers
Paul Suckling
|