Aleksandar Donev writes:
> I am going to ask a "why so" F95 question again, and hope the answer is
> not the dreaded "just because".
Nah. I think there are actual answers to this one. Indeed, it is a
question that has been asked several times...though it is possible
that they were on comp.lang.fortran instead of here. I forget what
happens where (and I frequent clf more than this list).
> Fortran 95 says that two or more part references with nonzero rank must
> not be specified in a structure component.
Yep. You can't have arrays of arrays. One big reason that I recall
is that there are two obvious ways of doing it. They are
incompatable, and different choices are "obvious" to different people,
or even to the same person in different applications. So claiming
that the right choice is obvious (to you) doesn't actually help.
> type point3D
> real :: coordinates(3), data(2)
> end type point3D
> type(point3D), dimension(10) :: points
...
> points[1:2]%coordinates[:]
> It seems to me the second one should produce a rank-2 array section
And would that be of shape (/2, 3/) or (/3, 2/)? There's the rub.
There are arguments for both. Either way is going to confuse someone.
Seems to me that last time this came up, Dick Hendrickson mentioned
another reason also....but I've forgotten it again (or possibly
confused this with a different question).
--
Richard Maine | Good judgment comes from experience;
[log in to unmask] | experience comes from bad judgment.
| -- Mark Twain
|