(j3.2006) reduction routine

Van Snyder Van.Snyder
Thu May 20 14:27:43 EDT 2010


On Wed, 2010-05-19 at 23:52 -0700, Malcolm Cohen wrote:
> > This is one of the reasons that I proposed in 04-391r1 to provide a
> > means to resolve a generic name without evaluating arguments of invoking
> > the specific procedure to which it is resolved.
> 
> Which does not on the face of it solve the stated problem, viz.
> 
> > On Wed, 2010-05-19 at 08:06 -0700, Bill Long wrote:
> >> Suppose you wanted to have an intrinsic that did a general reduction
> >> operation, such as
> >>
> >> call reduction (array, operation, result)
> >>
> >> where there is an intrinsic or defined operation specified by the
> >> 'operation' argument that is visible in the caller scope.
> 
> Note the word "intrinsic" here.
> 
> One could extend 04-391r1 to require vendor provision of (presumably unnamed) 
> specific procedures for all intrinsic procedures and operations.  And 
> assignment?  Defined i/o might be fun too.

04-391r1 was presented in the context of gathering general requirements.
It was intentionally superficial because Malcolm had argued more
strongly than anybody else against providing all the details.

But... to suggest more details, "resolve ( operator(+), a, b )" ought to
work for intrinsic numeric A and B.  Yeah, it implicitly requires the
processor to provide a generic "+" function and its specifics, but their
names don't have to be specified in the standard.  And it would be nice
if they could be elemental, but that's an orthogonal discussion.

> 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 and dynamic
> dispatch applied within it should that be what he wishes.

The procedure argument can't be generic or elemental.

Pay your money and take your choice: 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.





More information about the J3 mailing list