(j3.2006) reduction routine

Malcolm Cohen malcolm
Thu May 20 21:01:14 EDT 2010


--------------------------------------------------
From: "Aleksandar Donev" <adonev at lbl.gov>
Date: ?? 22?5?21? 0:59
To: "fortran standards email list for J3" <j3 at j3-fortran.org>
Subject: Re: (j3.2006) reduction routine

> On Wednesday 19 May 2010, Malcolm Cohen wrote:
>> Anyway, I think that no special form is necessary - just have
>> REDUCTION take a procedure argument, and apply the procedure.  The
>> user can write his own function and have both genericity
> I do not see how the user can do this.

Easily.

>The dummy arguments will have to
> be declared with some type.

More to the point, under all reasonable suggestions the ACTUAL arguments have to 
be declared with some type.  And rank.  And type parameters (if any).  Writing a 
trivial specific procedure for those ACTUAL arguments is not an intolerable 
burden.

> Sure, the user can call a generic in the
> procedure, but that will be resolved at the time the procedure is
> compiled, not when the REDUCTION is called, which is what I think Bill
> wants (and users would).

Generics are ALWAYS resolved at compile time, and NEVER resolved at call time.

If you mean "when the call to REDUCTION is compiled", well that's why the user 
gets to provide a trivial actual specific procedure for use *with that call to 
REDUCTION*.

Doing this requires no work in the compiler (beyond the actual reduction 
processing), a bare handful of extra lines for the user, no bizarro-land 
language weirdities, it All Just Works with the normal procedural stuff that one 
might even hope the average Fortran programmer could understand.

>> and dynamic
>> dispatch applied within it should that be what he wishes.
> This depends on what the procedure of this interface is
> allowed/specified to be

I was under the impression that we were discussing a reduction that could be 
applied to an array of any type.  Clearly(!) that gets us into the land of "if 
we want to have dynamic dispatch we can".

> ---it will only work if type information is also
> passed. With an intrinsic we can of course be more flexible and allow
> either CLASS or TYPE dummy arguments, or something like this.

I certainly hope we're talking about an intrinsic reduction, or what is the 
point of this discussion?

Van Snyder wrote:
> Allow generic identifiers as actual arguments, provide a means to resolve a 
> generic to a specific without evaluating arguments or invoking it, or don't 
> address Bill's requirements.

Non-sequitur.  The weird generic resolution stuff just doesn't have anything to 
do with wanting to reduce an array by an operation.  Just like quadrature - the 
user writes a function to integrate.  That's all there is to it.  Like 
quadrature, this isn't something the user is going to be writing hundreds of 
thousands of differently-typed versions of, which is why there is little scope 
for sweetness in any syntactic sugar.

Cheers,
-- 
................................Malcolm Cohen, Nihon NAG, Tokyo.
 




More information about the J3 mailing list