Accessibility-check for GENERIC bindings' targets
  Home FAQ Contact Sign in
comp.lang.fortran only
 
Advanced search
POPULAR GROUPS

more...

comp.lang.fortran Profile…
 Up
Accessibility-check for GENERIC bindings' targets         


Author: Daniel Kraft
Date: Aug 31, 2008 01:04

Hi,

I just stumbled upon this problem:

MODULE m1

TYPE t1
CONTAINS
PROCEDURE, NOPASS, PRIVATE :: proc
END TYPE t1

CONTAINS

SUBROUTINE proc ()
END SUBROUTINE proc

END MODULE m1

MODULE m2

TYPE, EXTENDS(t1) :: t2
CONTAINS
GENERIC :: gen => proc
END TYPE t2

END MODULE m2
Show full article (0.88Kb)
3 Comments
Re: Accessibility-check for GENERIC bindings' targets         


Author: Daniel Kraft
Date: Aug 31, 2008 01:06

Daniel Kraft wrote:
> MODULE m1
>
> TYPE t1
> CONTAINS
> PROCEDURE, NOPASS, PRIVATE :: proc
> END TYPE t1
>
> CONTAINS
>
> SUBROUTINE proc ()
> END SUBROUTINE proc
>
> END MODULE m1
>
> MODULE m2

USE m1 here of course, sorry for the mistake.
Show full article (0.95Kb)
no comments
Re: Accessibility-check for GENERIC bindings' targets         


Author: nospam
Date: Aug 31, 2008 01:13

Daniel Kraft wrote:
> Is the GENERIC binding invalid as it targets a PRIVATE specific binding?

No, that would not be a reason for it to be invalid.
> If the code was valid, this would mean that any PRIVATE type-bound
> procedure can be made accessible by extending the type and defining
> there a PUBLIC GENERIC binding targetting it, wouldn't it?

Private things can be made accessible in many ways. It is a fundamental
error to think that the private atribute on something means that the
entity cannot be accessed outside of the module.

The *ONLY* thing that the private attribute does is prevent the export
of the particular identifier (usually a name). It does *NOT* prevent
access to the inderlying entity by any other means that might happen to
not require using the identifier in question outside of the module.

For a trivial example, one could have an entity whose name is declared
private, but which is also the target of a public pointer. There are
other ways as well.

Another way of expressing this is that the private attribute attaches
only to the identifier(name), rather than to the underlying entity.
Show full article (1.33Kb)
no comments
Re: Accessibility-check for GENERIC bindings' targets         


Author: Daniel Kraft
Date: Aug 31, 2008 01:23

Richard Maine wrote:
> Daniel Kraft wrote:
>
>> Is the GENERIC binding invalid as it targets a PRIVATE specific binding?
>
> No, that would not be a reason for it to be invalid.
>
>> If the code was valid, this would mean that any PRIVATE type-bound
>> procedure can be made accessible by extending the type and defining
>> there a PUBLIC GENERIC binding targetting it, wouldn't it?
>
> Private things can be made accessible in many ways. It is a fundamental
> error to think that the private atribute on something means that the
> entity cannot be accessed outside of the module.

Thanks Richard, your explanation was exactly what I was looking for! I
already supposed that the code was valid but wanted to get some opinions
on it (as I wouldn't really claim I know F2003 well).

Yours,
Daniel
Show full article (0.94Kb)
no comments

RELATED THREADS
SubjectArticles qty Group
Re: Access XP can create Access 2000 MDE ?microsoft.public.access ·
How do I 'back migrate' an Access database from Access 2007 to 200microsoft.public.access ·