From owner-sc22wg5+sc22wg5-dom8=www.open-std.org@open-std.org  Mon Aug  5 10:06:02 2013
Return-Path: <owner-sc22wg5+sc22wg5-dom8=www.open-std.org@open-std.org>
X-Original-To: sc22wg5-dom8
Delivered-To: sc22wg5-dom8@www.open-std.org
Received: by www.open-std.org (Postfix, from userid 521)
	id 4736D357194; Mon,  5 Aug 2013 10:06:01 +0200 (CEST)
Delivered-To: sc22wg5@open-std.org
Received: from nag-j.co.jp (nag-j.co.jp [111.68.142.10])
	by www.open-std.org (Postfix) with ESMTP id 9C048357178
	for <sc22wg5@open-std.org>; Mon,  5 Aug 2013 10:05:40 +0200 (CEST)
Received: from Maru6 (218-42-159-105.cust.bit-drive.ne.jp [218.42.159.105])
	(authenticated bits=0)
	by nag-j.co.jp (8.14.5/8.14.5) with ESMTP id r7585TOX059369
	for <sc22wg5@open-std.org>; Mon, 5 Aug 2013 08:05:38 GMT
	(envelope-from malcolm@nag-j.co.jp)
Message-ID: <D475554D63BA460C8427CB3E0F8F3DB3@Maru6>
From: "Malcolm Cohen" <malcolm@nag-j.co.jp>
To: "WG5" <sc22wg5@open-std.org>
References: <20130710091604.2E25F35700C@www.open-std.org> <20130801131842.02EE4357123@www.open-std.org>
In-Reply-To: <20130801131842.02EE4357123@www.open-std.org>
Subject: Re: [ukfortran] (SC22WG5.5053) WG5 vote on draft TS on further coarray features
Date: Mon, 5 Aug 2013 17:05:29 +0900
Organization: =?utf-8?B?5pel5pysTkFH?=
MIME-Version: 1.0
Content-Type: text/plain;
	format=flowed;
	charset="utf-8";
	reply-type=response
Content-Transfer-Encoding: 7bit
X-Priority: 3
X-MSMail-Priority: Normal
Importance: Normal
X-Mailer: Microsoft Windows Live Mail 15.4.3555.308
X-MimeOLE: Produced By Microsoft MimeOLE V15.4.3555.308
Sender: owner-sc22wg5@open-std.org
Precedence: bulk

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. 

