This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFC: Plan to implement FINAL (with polymorphism)


Salvatore Filippone wrote:
* I have the impression that we need to generate destructor functions
for each possible rank, not only those that are actually used --
because we do not know in advance all places where a type currently
compiled may be used. Or can we avoid this?

Not necessarily, since the FINAL procedure can be elemental. According to the F2003 handbook, sec. 4.4.11.3 (I believe matches the
standard) if an array is involved, then either there is a final that
matches the rank, or there is an elemental one. The rank-matching
routine has precedence over the elemental.
Thus, a sensible default is to have an elemental first, then add special
cases if/when neede; I would expect most user codes to be structured
this way.

Yes exactly. But I do not see how this relates to the point above? What I meant was to generate a destructor function for each possible rank that does more than the user-provided FINAL procedure (i.e., components and super-type as well).


Whether we call a rank-matching user-procedure, ELEMENTAL one or none (if neither is available) is decided by the compiler when creating the destructor by the rules in the standard. But it seems to me this is a completely different issue?

Daniel

--
http://www.pro-vegan.info/
--
Done:  Arc-Bar-Cav-Kni-Ran-Rog-Sam-Tou-Val-Wiz
To go: Hea-Mon-Pri


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]