(j3.2006) Did we intend this to be OK?

Cohen Malcolm malcolm
Wed Oct 7 20:23:31 EDT 2015


Van Snyder asks:
>Did we intend this to be OK?

There's no program here, so hard to be sure...

He asserts:
>Other than within the module where T1 is defined, one cannot reference
>either x%p or x%g.

Yes.

>  One can (apparently) access x%p using y%g, even in a
>different module.

No.

I do not see how these differ from other similar public/private visibility 
cases, e.g.

Module junk2
  Private g
  Interface g
    Module Procedure p1
  End Interface
Contains
  Subroutine p1
    Print *,'p1'
  End Subroutine
End Module
Module junk3
  Use junk2
  Interface g
    Module Procedure p2
  End Interface
Contains
  Subroutine p2
    Print *,'p2'
  End Subroutine
End Module
Program test
  Use junk3
  Call g
End Program

There is no doubt that the PRIVATE G in junk2 does not "connect up" with the 
PUBLIC G in junk3, and that this is therefore
(a) unambiguous
(b) prints "p".

I am aware that several compilers do not get the visibility of type-bound 
generics quite right here, so possibly Van is being misled by a compiler 
bug.

Cheers,
-- 
........................Malcolm Cohen, Nihon NAG, Tokyo. 




More information about the J3 mailing list