(j3.2006) Absurdity concerning the PROTECTED attribute.

Bill Long longb
Mon Mar 30 17:44:25 EDT 2015


On Mar 30, 2015, at 2:55 PM, Van Snyder <Van.Snyder at jpl.nasa.gov> wrote:

> There appears to be an asurdity concerning the PROTECTED attribute.
> 
> In 10-007r1, 5.3.15p2 says "Other than within the module in which an
> entity is given the PROTECTED attribute, or within any of its
> descendants... it is not definable...."
> 
> Consider these modules:
> 
> module m1
>  integer :: I
> contains
>  subroutine S1
>    i = 42
>  end subroutine S1
> end module m1
> 
> module m2
>  use m1, only :: I
>  protected I


I would be quite happy to get rid of (at least make obsolete) most of the attribute statements, including PROTECTED.  Only VOLATILE and ASYNCHRONOUS serve any useful purpose anymore.  If we did not have a PROTECTED statement, this problem would not arise. 

Cheers,
Bill


> end module m2
> 
> module m3
> contains
>  subroutine S3
>    use M1, only: I
>  ! use M2, only: I
>    i = 666
>  end subroutine S3
> end module M3
> 
> Is I definable in subroutine S1 in module M1?  5.3.15p2 says not.  This
> is absurd.  How about in subroutine S3 in M3?  Definablilty depends upon
> which USE statement is not a comment.  This seems to be nearly as
> equally absurd.
> 
> This begs for an interp.
> 
> Should it be prohibited to confer the PROTECTED attribute upon an entity
> that is accessed by use association, or should 5.3.15p2 be revised:
> "Where an entity is accessed by use association, if it has the PROTECTED
> attribute in the module from which it is accessed then...?"  The former
> is simpler, and seems more sensible than the inconsistent alternative,
> i.e., allowing or prohibiting definabililty in S3 depending upon whether
> I as accessed from M1 or M2.
> 
> I'll write an interp, but it would be nice to have consensus regarding
> on which side of the court the ball will drop.
> 
> 
> _______________________________________________
> 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