(j3.2006) (SC22WG5.5057) [ukfortran] WG5 vote on draft TS on further coarray features
Malcolm Cohen
malcolm
Mon Aug 5 04:05:29 EDT 2013
Nick Maclaren writes:
>Passim. The specification is messy and restrictive, and should be
>changed. For example, it is not possible to reduce INTENT(IN) examples.
I agree.
>A far better solution would be either two procedures or a generic
>interface, of the following forms (CO_REDUCE is used as an example):
>
> CO_REDUCE (SOURCE, OPERATOR [, STAT, ERRMSG])
> ! SOURCE would be INTENT(INOUT)
>
> CO_REDUCE (SOURCE, OPERATOR, RESULT [, RESULT_IMAGE, STAT, ERRMSG])
> ! SOURCE would be INTENT(IN)
Unfortunately this particular scheme does not work when SOURCE is a scalar
integer, because
CO_REDUCE(integer,procedure,integer)
is ambiguous as to whether it is the first form or the second.
It would work if they had otherwise-gratuitously-different argument orderings,
e.g.
CO_REDUCE (SOURCE, OPERATOR [, STAT, ERRMSG])
! SOURCE would be INTENT(INOUT)
CO_REDUCE (OPERATOR, SOURCE, RESULT [, RESULT_IMAGE, STAT, ERRMSG])
! SOURCE would be INTENT(IN)
(Swapping OPERATOR and RESULT also works, but this keeps RESULT and RESULT_IMAGE
together.)
The same is true of CO_SUM, but there is no OPERATOR to swap so that's a bit
harder to tweak.
It's probably clearer to have CO_SUM and CO_SUM_SELF. Or something.
Cheers,
--
................................Malcolm Cohen, Nihon NAG, Tokyo.
More information about the J3
mailing list