(j3.2006) [POSSIBLE SPAM] Re: Coindexed scalars, etc.

Bill Long longb
Tue Jan 20 14:19:03 EST 2009

Aleksandar Donev wrote:
> Hi John,
>> Aleksandar Donev wrote:
>>> I think the [] should always go at the end, after all the local 
>>> selectors, including substrings, so I vote for c(i)(l:r)[p]. For %Re and 
>>> %Im I agree that they should be treated as components.
>> No. We don't have arrays of single characters, we have arrays of type character. 
>> Selecting a substring is like selecting a component of a structure. Anyway,
>> I see this as a change not allowed by Resolution T7
> I certainly did not indend to propose technical changes of any sort. I 
> thought this had not been decided before and the syntax did not decide 
> one way or another. Character strings have been messed up from thirty 
> years ago so I am not about to try to fix them. Go with whatever the 
> original design/intent was.
> Aleks

Just to clarify (I hope) what constitutes the intended design - in a 
reference the [ ] are attached to the thing that is a coarray, in the 
same way they are attached in the declaration.  C615 [120:13] says this, 
but it seems to have escaped notice.  So, if you have a parent 
structure, P, and a component, C, then

P[j]%C  is correct if P was declared to be a scalar coarray  (or 
P(i)[j]%C if P is a rank-1 array).

P%C[j] is correct if the parent is not a coarray, but the component is a 
scalar coarray.

The syntax for a complex-part-designator, [121:6-7], does not allow for 
anything after the %RE or %IM.   If Z is a complex coarray and also a 
rank-1 array, then Z(i)[j]%RE would be correct.

The syntax for a substring [119:9]  similarly does not allow for 
anything after the (subscript-range).  If T is a character(10) coarray 
scalar, then T[j](1:4) would be correct.  If T were a rank-1 array, then 
T(4)[j](1:4) would be correct.

I believe the examples above are consistent with what 09-007 says, 
modulo fixing the scalar coindexed reference problem Van brought up, and 
for which a paper is forthcoming.

The remaining discussion has been about whether a coindexed reference to 
an array should be allowed to omit the array subscript part of the 
syntax.  This would represent a feature change, rather than fixing a 
serious defect.


Bill Long                                   longb at cray.com
Fortran Technical Support    &              voice: 651-605-9024
Bioinformatics Software Development         fax:   651-605-9142
Cray Inc., 1340 Mendota Heights Rd., Mendota Heights, MN, 55120


More information about the J3 mailing list