(j3.2006) Finalization ordering question

Bill Long longb
Wed Oct 24 12:12:57 EDT 2007

Jim Xia wrote:
> > > Sorry Kurt, you've just got a no vote from me.  It's too late to
> > > change rules now after we've implemented them all.  IMHO the current
> > > text of the finalization process is clear and unambiguous.  
> >
> > So, when you say that the rules are clear, I assume you mean that the
> > parent component finalizer is called for the whole base array, not
> > elementally. Right?
> >
> > Cheers,
> > Bill
> No.  The term "parent component" is only relevant to each individual 
> scalar element of the array, and it is treated almost the same as any 
> explicitly declared component (I just noticed in F2008, we introduced 
> a new term "direct component").  So the step 3 of the finalization 
> process is applied to each element using a scalar finalizer for the 
> parent component if there is one.  You wouldn't finalize the parent 
> component in an array fashion just the same reason you don't do that 
> for any finalizable component of the derived type.
> Cheers,
> Jim Xia

That might be a logical thing to do, but I don't read the words in the 
standard as supporting this.  Step 3 says "the parent component is 
finalized".  The rules for finalizing an entity are spelled out, and 
they start with Step 1.  If there is an array final routine specified 
for the parent type, it seems that Step 1 requires that be used. 
Chopping an array into elements only occurs during Step 2, and in this 
case you never make it to Step 2. That may not be what was intended, but 
the way I read it that's what it says.  Note that this is a non-trivial 
distinction since the array and scalar final routines might do different 


Bill Long                                   longb at cray.com
Fortran Technical Support    &              voice: 651-605-9024
Bioinformatics Software Development         fax:   651-605-9142
Cray Inc., 1340 Mendota Heights Rd., Mendota Heights, MN, 55120


More information about the J3 mailing list