I agree there are situations where a constant kernel is more efficient than a non-constant kernel. In Arrow we have such implementations even for the basic arithmetic functions.
However, this puts YAML writers in a situation where they have to make decisions based on implementation efficiency and performance. For example, should the second (`y`) argument of `foo(x, y)` be a constant? My engine has decided it's too expensive but another engine came to a different decision. So what should I do?
For some practical examples:
- The round kernel does not define the "number of digits to round to" argument as constant.
This was originally at odds with the Arrow engine which did require that to be constant.
- You gave the example of regular expressions. There are engines out there (e.g. both
spark and postgres) that actually do support non-constant regular expressions.
- Another case that is almost always constant is time zone strings. However, we have had
asks in Arrow to support a non-constant case. So it is certainly something that could happen.
My point is that I think extension files should be focused on the semantics of the function. When it comes to scalar functions, I don't think "constant" is a semantic part of the function. It's only an optimization / implementation decision at that point.