how to reference module variable without the use of USE, but explicit?
- From: "Nasser M. Abbasi" <nma@xxxxxxxxx>
- Date: Fri, 25 Mar 2011 19:23:48 -0700
Suppose one have module:
---------- m.f90 ---------
module m
public
integer :: z;
end module m
--------------
and program that uses the above module:
---------- test_m.f90 ----------
program test_m
use m
implicit none
z = 5;
end
--------------------
The above works OK. But I'd rather be explicit in saying in which
module the variable z is in. So I wanted to write
-------------------
program test_m
implicit none
m%z = 5; (or m.z or something like that)
end
-------------------
But that does not work. This also do not work:
---------------------
program test_m
USE m
implicit none
m%z = 5;
end
---------------------
I know, wrong syntax. It thinks 'm' is variable.
I want have the association to the module name be there,
where I can see it, and not global.
Because if one has 10 modules being USE'D, then one can more easily
see in the code which variable belongs to which module if the
module name can be part of the variable name.
Looked at many examples, but they all just do the global USE
and then in the code, just use whatever that module exports.
Any idea what is the right syntax to do what I want?
For example, in Ada, I can write m.z=5; where m is a
package name, same as Fortran module.
thanks,
--Nasser
.
- Follow-Ups:
- Re: how to reference module variable without the use of USE, but explicit?
- From: Armelius Cameron
- Re: how to reference module variable without the use of USE, but explicit?
- From: Armelius Cameron
- Re: how to reference module variable without the use of USE, but explicit?
- From: James Van Buskirk
- Re: how to reference module variable without the use of USE, but explicit?
- From: steve
- Re: how to reference module variable without the use of USE, but explicit?
- Prev by Date: Re: can one use o.method() in Fortran OO ?
- Next by Date: Re: how to reference module variable without the use of USE, but explicit?
- Previous by thread: Read a list with undefined length
- Next by thread: Re: how to reference module variable without the use of USE, but explicit?
- Index(es):
Relevant Pages
|