(j3.2006) types with finalizers defined in finalizer

Van Snyder Van.Snyder
Thu Aug 21 14:17:01 EDT 2008


On Thu, 2008-08-07 at 23:24 -0700, Robert Corbett wrote:
> The following module appears to be standard-conforming
> 
>        MODULE MOD
>        CONTAINS
>          SUBROUTINE FINAL(X)
>            TYPE T
>              INTEGER I
>            CONTAINS
>              FINAL FINAL
>            END TYPE
>            TYPE(T) :: X
>          END SUBROUTINE
>        END
> 
> This is the only instance of which I am aware that allows
> a derived-type with a finalizer to be declared in a
> context other than the specification part of a module.
> It requires extra work on the part of the compiler to
> support a feature that is worthless.  Did I miss a
> prohibition in the standard?  Does anyone think there is
> a reason to allow such code in a standard-conforming
> program?  If so, what is that reason?
> 
> Bob Corbett
> _______________________________________________
> J3 mailing list
> J3 at j3-fortran.org
> http://j3-fortran.org/mailman/listinfo/j3

We didn't take up this question at meeting 185 (we had plenty without
it).

The example doesn't conform to the standard because the subroutine isn't
declared to be recursive.

I don't think it's necessary to write constraints

"C4xx (R4xx) If a type definition appears within a subprogram, the
      final procedure shall not be one defined by that subprogram.

"C4xx (R4xx) A final subroutine shall not be recursive."

-- 
Van Snyder                    |  What fraction of Americans believe 
Van.Snyder at jpl.nasa.gov       |  Wrestling is real and NASA is fake?
Any alleged opinions are my own and have not been approved or
disapproved by JPL, CalTech, NASA, the President, or anybody else.




More information about the J3 mailing list