(j3.2006) Component etc. names
Van Snyder
Van.Snyder
Tue Apr 24 22:43:37 EDT 2012
On Wed, 2012-04-25 at 11:04 +0900, Malcolm Cohen wrote:
>
>
> TL;DR - scoping is covered by the scoping rules 16.3.1, and answers all of these
> "questions". C514 has nothing to do with any of these questions.
> C514 does not cover multiple entities in the same scoping unit either. That is
> the job of the scoping rules!
I should have known better.
I asked
> >Can I have
> >
> > type :: T
> > contains
> > procedure :: Final
> > final :: Final
> > end type T
Since a <final-procedure-stmt> establishes a type-bound procedure
binding that has no identifier, the scoping rules in 16.3.1p1(2) and
16.3.1p3 do not prohibit this.
I also wrote
type :: T
contains
procedure :: Force_Finalization => Final
final :: Final
end type T
> >Apparently, neither one is possible. C456 requires the passed-object
> >dummy argument to be polymorphic, while C480 requires the argument of a
> >final subroutine NOT to be polymorphic.
>
> C456 does not even require there to BE a passed-object dummy argument. If there
> is none, there is no requirement on it.
Since the bindings "procedure :: Final" and
"procedure :: Force_Finalization => Final" don't specify NOPASS, they
have a passed-object dummy argument, because the final subroutine
"Final" is required to have an argument of the type. Thus, although the
type definitions are permitted by the scoping rules, the bindings cannot
work because C456 and C480 impose conflicting requirements.
The scoping rules appear to allow
type :: T
integer :: Final
contains
final :: Final
end type T
or
type :: T
contains
procedure :: Final => Force_Finalization
final :: Final
end type T
because the <final-procedure-stmt> establishes a type-bound procedure
binding that has no identifier.
One of my compilers, which appears to handle finalization correctly,
objects to the first, third and fourth of these type definitions on the
grounds that the identifier "Final" has conflicting attributes or
multiple declarations. Its error message points to the identifier Final
in the <final-procedure-stmt>. This appears to be bogus.
It objects to the second one on the grounds either that the argument of
Force_Finalization is required to be polymrphic (if I declare the
argument of Final using TYPE), or that the argument of Final is required
NOT to be polymorphic (if I declare it with CLASS). This appears to be
correct.
More information about the J3
mailing list