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

Van Snyder Van.Snyder
Thu Apr 23 23:50:43 EDT 2015


On Fri, 2015-04-24 at 03:39 +0000, Bill Long wrote:
> On Apr 23, 2015, at 3:35 PM, Bader, Reinhold <Reinhold.Bader at lrz.de> wrote:

> > 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. 

Alternatively, "A submodule shall not access an entity of its ancestor
module by use 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.

Another possibility is another attribute for a USE statement that says
"I only want the stuff that's declared or defined in the specified
module -- nothing it got by use association -- maybe something like

  submodule(mod_a) :: submod
    use, direct :: mod_a [, only: ....]

This would put the onus on submod instead of mod_b.

Would either of these proposals allow access to the type(a) component of
type b in submod?  Probably, because type a is accessible in submod by
host association.





More information about the J3 mailing list