Support where-clause evaluation in registration annotations #3841
+286
−234
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add (primitive) support for where-clause evaluation to
registerCommand
andinstantiateAndRegister
. Both annotations now evaluate the procedure's where-clause and will only generate instantiations for sets of generic parameters where the where-clause would evaluate totrue
.The primary goal of this change is to be able to remove extraneous overloads of command procedures that simply return an error message indicating that some set of types and/or array ranks are not supported for that command. For example, in the following code snippet, the second overload of
asdf
can now be removed because the build system won't attempt to generate an instantiation for it:This feature is not totally general-purpose yet. Current limitations:
param
-function calls are currently supported. Specifically, support forisIntegralType
and other related procedures from Chapel's Types module is hard-coded in, but any other function calls within a where-clause will not workparam
ortype
methods/fields are accessibleetype
orrank
directly is not yet supported (ex:where x.etype != bool && x.rank < 3
)param
ortype
fields of a non-array argument is not yet supported (ex:where mySparseSym.matLayout == Layout.CSR
)Eventually,
registerCommands.py
should be modified to use the Compiler's resolver to speculatively evaluate where-clauses in a much more robust manner. This would in principle remove the above limitations, but is likely a more significant development effort than the solution in this PR.Limitations aside, this PR allows most of the extraneous procedures currently in Arkouda to be removed.
Note: one can opt out of this feature by setting the
ignoreWhereClause
argument in the annotation call. This could be useful in an example like the one below, or to get around one of the limitations listed above.