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]

[RFC] polymorphic arrays


Hi all,

after having made some reasonable progress on general OOP bug bashing,
I think it's time to move on to extending our OOP implementation from
the present scalar-only mode to polymorphic arrays. Since this is a
major task, I thought it may be useful to do a little brainstorming
and discuss the basic concepts with the gfortran team, before actually
starting the implementation.

I'll start with a little reminder of what we currently do with scalar
polymorphic variables like this:

CLASS(some_type), POINTER :: p

We wrap such a variable into a "class container", which is simply a
struct containing two fields:
1) A "$data" field, which points to the actual data of the variable.
2) A "$vptr" field, determining the 'dynamic type' of the variable,
which may be any type extended from the 'declared type' (which is
'some_type' in the example).

Now the question is what to do for polymorphic arrays, i.e. CLASS
variables with the DIMENSION attribute. Basically I see two
possibilities:
1) Use the class container also for polymorphic arrays, and have the
"$data" field point to an array descriptor.
2) Extend the array descriptor to include some "$vptr" field, which
would determine the dynamic type of the array, and use this instead of
a class container.

Would both of these implementations actually work? If yes, which one
is favorable? Are there any further alternatives? [I'm currently
slightly tending to prefer option #2, but since I have no experience
with array descriptors at all, I'd like to hear other opinions.]

Cheers,
Janus


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