Closed paul-tqh-nguyen closed 2 years ago
Totals | |
---|---|
Change from base Build 1479560165: | 0.0% |
Covered Lines: | 3884 |
Relevant Lines: | 4594 |
I had an internal dialog with myself -- capturing here for others to consider.
I had the thought that DWIM rewriting should happen on the generic versions of operations. That way anyone who manually writes a generic call (useful for user-defined operators) will get the benefit of DWIM rewriting.
I have decided this is a bad choice because several operations have custom operators which don't go through the generic machinery. For example, ReduceToVector
with count
doesn't lower to generic. Instead, it writes the full lowering pass directly (because it is both easy to write and much more efficient than going through the generic looping). For the case of ReduceToVector
, that would require DWIM rewriting to handle both ReduceToVector
and ReduceToVectorGeneric
. That is asking too much of DWIM rewriting.
So, I think we should only perform DWIM rewriting on the non-generic operations. That should cover the 99% of normal cases, giving users freedom in writing algorithms without worrying about the strict requirements of the lowering algorithm. And for those users who need to manually write generic operations, they will have to operate in strict mode. But they are already "expert" users, so this is not much of a burden.
This PR also:
*::buildAlgorithm
to have a smaller signature.