New Issue: What can we do to simplify the use of reductions?

19714, "bradcray", "What can we do to simplify the use of reductions?", "2022-04-27T22:08:12Z"

As a Chapel programmer, if I define a record type with a + operator, it seems natural
that I should be able to apply + reduce to values of that record type. For example:

record R {
  operator +(x: R, y: R): R { ... }

var A: [1..n] R;
var sum = + reduce A;

var r: R;
forall i in 1..n with (+ reduce r) do

What can we, as the Chapel developers, do to enable this case? Traditionally, our answer
has been something like:

  • you can do that using a user-defined reduction (but those are work to write and not
    well-specified yet)
  • to support the general, parallel case (e.g., empty reductions, parallel reductions in which
    input, state, and output types differ), we need all of the methods that UDRs provide

But it seems as though, for simple cases like this in which the + operator's input and output
type match, we could enable them more easily (potentially requiring a 0-argument initializer
to use as a value for the "empty reduction" case?).