Description
Module variables and procedures can be private
or public
. As far as I understand, private
entities simply cannot be accessed from the outside at all (by other program units use
ing the module), while all public
entities are immediately accessible by anyone who use
s the module without (only
).
For convenience, and to help structure the entities in a module, it would be useful to have the possibility of specifying entities that can be accessed, but which must be explicitly specified with only
. For example:
module foo
integer, parameter, private :: fortytwo
integer, public :: const = fortytwo, version = 3
default :: const ! suggested syntax
end module foo
With this, use foo
would get access to const
only, while use foo, only: const, version
would get access to both variables.
If an empty default list is specified (maybe with default none
), it would enforce the use of only
in any use
attempt for the module.