(j3.2006) (SC22WG5.5472) J3/15-159 - J3 Fortran interp letter ballot #33 - due 24-Apr-2015

Bill Long longb
Thu Apr 23 23:39:45 EDT 2015

On Apr 23, 2015, at 3:35 PM, Bader, Reinhold <Reinhold.Bader at lrz.de> wrote:

> Hello all, 
> concerning Bills following comment
>> Comment for F08/0128:
>> The discussion in this interp illustrates why the argument in 09-141
>> was wrong. I think a better answer for this interp is that passing
>> 09-141 was a mistake and it is being corrected by reinstating the
>> prohibition on a submodule using its ancestor.  An alternative, but
>> equivalent answer, is that there is no rational reason to allow use of
>> its ancestor module in a submodule, and the failure to prohibit this
>> is an error in the standard.
> I agree that there is no need to allow use access to any entity from the ancestor 
> module in a submodule. However, I consider the following not only reasonable, 
> but also quite often necessary:
> module mod_a
>  type :: a
>   ...
>  end type
> end module
> module mod_b
>  use mod_a
>  type :: b
>     type(a) :: a
>  end type
> end module
> submodule(mod_a) :: submod
>  use mod_b, only : b
> end submodule

A bit convoluted, but I can imagine someone wanting to do this.   Two possible solutions:

1) Make the rule ?An entity in a module shall not be accessible by use association in a submodule of that module.?  This avoids the conflict of the entity appearing to be accessed by both use and host association. 

2) There was a proposal for a PRIVATE attribute on a USE statement.  In the example above,

  module mod_b
    use,private :: mod_a

would prevent anything from module mod_a from being accessible by use association in a subsequent scope via a USE of mod_b. Basically shorthand for listing everything use accessible from module mod_a in a PRIVATE statement in module mod_b.   One could argue that this is equivalent to avoiding a USE of mod_a in the submodule. 


> This, I think, would also be prohibited if the old restriction is reinstated. The feature request that
> I handed in ended up as 08-154r1, but subsequently triggered an UTI, as far as I recall. Is there 
> any way to retain the above example as conforming? Note that the ONLY clause implies that no 
> entity from the ancestor module is accessed; any access to "a" inside the submodule would work via 
> host association.
> Cheers
> Reinhold
> _______________________________________________
> J3 mailing list
> J3 at mailman.j3-fortran.org
> http://mailman.j3-fortran.org/mailman/listinfo/j3

Bill Long                                                                       longb at cray.com
Fortran Technical Suport  &                                  voice:  651-605-9024
Bioinformatics Software Development                     fax:  651-605-9142
Cray Inc./ Cray Plaza, Suite 210/ 380 Jackson St./ St. Paul, MN 55101

More information about the J3 mailing list