[J3] Elemental and optional arguments
José Rui Faustino de Sousa
jrfsousa at gmail.com
Mon Jun 28 13:11:23 UTC 2021
Dear Malcolm,
First of all I would like to thank you for kindly taking the time to
answer my questions.
On 28/06/21 08:27, Malcolm Cohen via J3 wrote:
> <<<
>
> >> A corollary of these two assumptions would be that shape conformance
> >> of graphically present actual arguments is mandatory, without regard
> >> to presence in the sense of 15.5.2.12, and reduces to rank matching.
> >
> > No.
> >>>
>
> I think this text in the standard is poorly written, possibly even
> defective. Anyway, shape conformance never “reduces to rank matching”.
>
I was assuming that if rank matching, which can be done at compile time,
fails there was no point in any further investigation of shape
conformance, for array actual arguments, and that an error could
unequivocally issued. Is this wrong?
> (We should probably split this sentence into a requirement that all
> nonscalar actual argument have the same rank, and a requirement that all
> actual arguments that are not absent dummies or disassociated pointers
> or unallocated allocatables have the same shape.)
>
This is specially important as 15.9.2, which you quote bellow, seems to
imply that it is possible to have actual arguments with different ranks.
> <<<
>
> >> ! In principle it is only possible to know if a is present at runtime,
> >> ! so this is most likely illegal. Although I don't know why has I
> >> ! don't think 15.5.2.12.3 (6) applies here.
> >> b = efun(a)
> >>>
>
> This requires a to be allocated, otherwise “the shape of the result is
> thesame as the shape of the actual argument with the greatest rank.” has
> no meaning, as an unallocated array has no shape.
>
So this can be decided, albeit in a probably surprising way to the end
user, for one actual argument.
What about if there are several actual arguments corresponding to
optional dummy arguments (even worst if they could have different
ranks)? Is the processor required to iterate through the actual argument
list, at runtime, to find out if there is any present argument?
Once again thank you very much for your time.
Best regards,
José Rui
More information about the J3
mailing list