[RFC] polymorphic arrays
Janus Weil
janus@gcc.gnu.org
Thu Aug 5 20:34:00 GMT 2010
>> Btw, another asymptotic aim for our OOP implementation could be to
>> have consistency/interoperability with C++ classes. However, I
>> presently have too little knowledge of the implementation of
>> poylmorphism in g++ to say anything more concrete about this topic at
>> this point (any pointers in this direction are welcome, though).
>
> That sounds like a very interesting goal; however, I'm not really sure it is
> a very achievable one -- thinking of multiple inheritance, virtual
> inheritance and probably also a lot of small differences between OOP in C++
> and Fortran.
Well, good point. I am aware that the OOP features in C++ and Fortran
are not completely identical. Nevertheless I had the naive notion that
both would be sufficiently related in order to have some
interoperability. I guess my assumption was that Fortran OOP would be
some kind of subset of C++ OOP (minus multiple inheritance etc). If
this is true (and it really is nothing more than a wild guess at this
point), then one should be able to use the same underlying structures
and techniques for both. Which means it should be possible to e.g.
create a polymorphic variable in C++ code and call its methods from
Fortran and stuff like that ...
> Do you think this would really be useful at a greater scale?
Definitely. ISO_C_BINDING is an important and widely-used feature of
Fortran2003. OOP interoperability would be a natural extension of
this. But maybe we should wait until this gets standardized (assuming
it will)?!? OTOH, in a compiler framework like GCC which implements
several OOP-capable languages (C++, Java, F03, ...), it would only be
natural to share one underlying implementation technique. [I guess
this comes close to the basic idea of GCC itself: To use one common
middle-end representation for different programming languages.]
> BTW, I think that Java does something like it...
What do you mean? Are you saying that gcj shares g++'s OOP
implementation? Or are you talking about the Java language in general?
Cheers,
Janus
More information about the Fortran
mailing list