#798: allow calculations in parameter assignments in parameter files --------------------------+------------------------------------------------- Reporter: rhaas | Owner: Type: enhancement | Status: reopened Priority: optional | Milestone: Component: Cactus | Version: Resolution: | Keywords: --------------------------+-------------------------------------------------
Comment (by knarf):
Right. The usage with (x+y) is so common that I didn't think of other possibilities. However, the only other usage I found is ((x>y)*x+!(x>y)*y) - essentially max(x,y) - which is also commutative. I don't think we should really support non-commutative expressions here, this was probably never intended. But you are right, this is beyond the scope of this ticket.
What would be important here is: should entries within parameter files be order-independent? I would argue that this would be a good idea.
Concerning an implementation: Yes, the parameter file would need to be parsed multiple times: first for the active thorns and at least once more for the actual parameters (#705). And yes, Cactus would need to track dependencies.
Writing to a parameter that has already been read would be flagged as
error.
Consider:
{{{ A::a = "=B::b" B::b = 5 }}}
When parsing this line-by-line, A::a would get the default value of B::b (let us assume 4), would be marked as being read, and the second line would throw an error. But what we actually want is that A::a = 5, not 4, and no error.