[J3] USE statement – wish: permit specifying additionally the access-spec

Bill Long longb at cray.com
Fri Nov 15 11:14:23 EST 2019


Hi Tobias,

We already allow 

module A
   use B
   private :: B


which has the effect of making everything accessed from B private. Hence the things public in B do not “leak” through to a scope that as a USE A. 

Cheers,
Bill

> On Nov 15, 2019, at 10:00 AM, Tobias Burnus via J3 <j3 at mailman.j3-fortran.org> wrote:
> 
> Hi all,
> 
> I want to suggest to permit the 'access-spec' to the use-stmt to set the public/private default for the symbols use-associated (overridable by an explicit access-stmt). – Thoughs?
> 
> Real-world use case the following:
> 
> I have two modules, one contains some definitions of parameters and the other contains some internal procedures. I now use-associate the two and what I would like to do is the following.
> 
> Note the 'use, private' and 'use, public' with the access-spec. Currently, I end up using 'private' and then adding 'public' for all symbols from 'openacc_kinds', which is neither very readable nor maintainable.
> 
> module openacc
>   use, private :: openacc_internal
>   use, public :: openacc_kinds
>   implicit none (type, external)
> 
>   private
>   public :: acc_get_num_devices
> 
>   interface acc_get_device_type
>      ! shall be private, from openacc_internal
>     procedure :: acc_get_device_type_h
>   end interface
> 
> Tobias
> 
> PS: The current version of the real-world file is
> https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=libgomp/openacc.f90;hb=refs/heads/trunk
> Some additions are in the pipeline (submitted) and I was looking at it to do some public/private cleanup.
> 

Bill Long                                                                       longb at cray.com
Principal Engineer, Fortran Technical Support &   voice:  651-605-9024
Bioinformatics Software Development                      fax:  651-605-9143
Cray, a Hewlett Packard Enterprise company/ 2131 Lindau Lane/  Suite 1000/  Bloomington, MN  55425





More information about the J3 mailing list