| Register | FAQ | Calendar | Search | Today's Posts | Mark Forums Read |
|
#1
| |||
| |||
| 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 Is the GENERIC binding invalid as it targets a PRIVATE specific binding? Or is this allowed in this case? I couldn't find anything about this in the draft F2003 standard's section about type-bound procedures. 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? Thanks, Daniel -- Done: Arc-Bar-Cav-Sam-Val-Wiz, Dwa-Elf-Gno-Hum-Orc, Law-Neu-Cha, Fem-Mal To go: Hea-Kni-Mon-Pri-Ran-Rog-Tou |
|
#2
| |||
| |||
| 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. > TYPE, EXTENDS(t1) :: t2 > CONTAINS > GENERIC :: gen => proc > END TYPE t2 > > END MODULE m2 > > Is the GENERIC binding invalid as it targets a PRIVATE specific binding? > Or is this allowed in this case? I couldn't find anything about this > in the draft F2003 standard's section about type-bound procedures. > > 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? Thanks, Daniel -- Done: Arc-Bar-Cav-Sam-Val-Wiz, Dwa-Elf-Gno-Hum-Orc, Law-Neu-Cha, Fem-Mal To go: Hea-Kni-Mon-Pri-Ran-Rog-Tou |
|
#3
| |||
| |||
| Daniel Kraft <d@domob.eu> 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. -- Richard Maine | Good judgement comes from experience; email: last name at domain . net | experience comes from bad judgement. domain: summertriangle | -- Mark Twain |
|
#4
| |||
| |||
| Richard Maine wrote: > Daniel Kraft <d@domob.eu> 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 -- Done: Arc-Bar-Cav-Sam-Val-Wiz, Dwa-Elf-Gno-Hum-Orc, Law-Neu-Cha, Fem-Mal To go: Hea-Kni-Mon-Pri-Ran-Rog-Tou |
![]() |
| Thread Tools | |
| Display Modes | |
In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.