Hi,
> Error: oo_style.F90, line 31: Cannot extend abstract type
> ABSTRACTVISITOR because it has a private deferred type-bound procedure
> VISITREAL
Helpful :-)
> The section of the standard that seems to support this notion is in
> section 4.5.6.1 Inheritance:
>
> NOTE 4.51
> Inaccessible components and bindings of the parent type are also
> inherited, but they remain inaccessible in the extended type.
This is a note and it does not support the above error message. It
merely states a fact that private bindings are inaccesible directly by
reference---they are accessible when doing table dispatch internally in
the compiler. Remember that private only refers to names, not actual
physical accessibility. It does not say that this is an obstacle to
extending, in fact, the very fact the note exists means one can extend
types with private type bound procedures. Somehow deferred bindings may
be different, but I don't see why (and I was the one that proposed added
deferred bindings in F2003, for what that's worth). The general
principle should always be not to forbid things unless there is a good
reason.
> I guess that it hinges on whether providing an actual procedure in place
> of a deferred counts as "accessing".
Overriding a binding would require specifying the name, which is what
private forbids (it hides the name). But this is not to say that you are
not allowed to extend the type in the first place (although, as you can
see, it makes it impossible to make the type non-abstract by actually
providing specific bindings, so you should probably rethink your
approach anyway).
Disclaimer: This opinion is not based upon digging through the standard,
mostly on recollection, so I may well be wrong.
Thanks,
Aleks
|