(j3.2006) reduction routine

Van Snyder Van.Snyder
Wed May 19 14:04:38 EDT 2010


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.

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.
> 
> How would you actually specify the operation to the routine?  In the old 
> days, one would have just passed the name of the procedure that performs 
> the operation as the actual argument.  In the new OOP world, all you 
> would know is a generic specifier or a symbolic operator name.  You 
> could write
> 
>   call reduction (X, ".my_oper.", ans)
> 
> where you expect the compiler to look up (or, for polymorphic variables, 
> generate code to look up) the function corresponding to the operator 
> .my-oper. that is defined for a variable of the dynamic type of X, and 
> then pass that on to the actual reduction routine.  [Such a scheme would 
> only work for an intrinsic, so that the compiler 'knows' what to do.] 
> This is a bit clunky, but appears to work.
> 
> Is there a better method?
> 
> Cheers,
> Bill
> 
> 
> 




More information about the J3 mailing list