(j3.2006) I think this is possible, but....
Malcolm Cohen
malcolm
Tue Jan 23 18:50:33 EST 2018
>The problem with using a polymorphic component is that all you can see,
>even in an extension of the type that contains it, is the declared type,
>until you "pop it open" using a SELECT TYPE construct.
That?s not the problem. The problem is that the component is not guaranteed (by the language) to be allocated to be the extension type. The type of the component is determined by the actual Fortran code. Since it?s the Fortran program that is responsible for the type, it?s quite rightly the Fortran program that?s responsible for doing SELECT TYPE, there?s no automatic way to do it.
Using polymorphic components you can do a lot more than plain genericity (hello heterogeneous structures); with that flexibility comes a little additional work. That?s almost inevitable unless you want to play unchecked pointer casts (those who do know where to find C++). It?s not a lot of work though (?strenuous gymnastics? is somewhat of an overexaggeration I feel).
Cheers,
--
..............Malcolm Cohen, NAG Oxford/Tokyo.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.j3-fortran.org/pipermail/j3/attachments/20180124/15eae0d3/attachment.html>
More information about the J3
mailing list