chapel-lang / chapel

a Productive Parallel Programming Language
https://chapel-lang.org
Other
1.79k stars 420 forks source link

Uniform handling of supported vs. unsupported operations on domains #19093

Open vasslitvinov opened 2 years ago

vasslitvinov commented 2 years ago

This issue requests an approach or approaches for error reporting that result in helpful user error messages and are easy for domain developers to follow. it talks about domains, however it likely applies to other data types as well.

Chapel defines a number of operations on domains. Only a handful of them can be invoked on any domain, such as rank and idxType. Most of those operations are restricted in several ways:

Also (aside?): some operations are performed as promotions over one or two of its arguments, possibly domains. For example: (associative domain) += (another domain).

These restrictions are currently enforced in a variety of ways:

When the domain method invokes a dsiXXX method on the _value class to implement the operation, additional variations are used:

Which of these approaches are "the best practices" and which we should proactively replace in our module code?

vasslitvinov commented 2 years ago

19070 improved the uniformity of user-facing errors.

Whereas this issue is about the structure of the implementation.