The issue #1322682: Many conditions may result in memory crashes? made me realize that there is sometimes need for conditions that run actions before evaluating conditions. (In the linked issue, there's a point in building up a list and then checking if it contains a selected string.) Thus, this is a feature request to have this in Rules!
I'm seeing at least two different approaches to this:
- Adding a component type with actions-and-then-conditions (instead of the other way around).
- Adding a component type that allows evaluating other (general) components before running explicitly defined conditions.
Approach 1 would probably be easier to use, but approach 2 is more general and more cool. (Thus, my vote right now is on component-and-then-conditions, rather than actions-and-then-conditions.)
A third approach just occured to me: allowing any component providing a boolean to be used as a condition component – meaning that rule sets could be conditions as well. I'm not sure that's a sane approach, though.
Comments
Comment #1
fagoWell, you can already do it with rule sets. Add a variable in the first rule, make use of it in the second rule. Maybe we should highlight this some more... :) Does that make sense for you?
I'd prefer to not adding any actions before evaluating conditions as actions can change the "global state", thus have an influence at the outcome of other conditions. That's bad as it makes any optimizations impossible that need to shuffle around rule-condition execution order.
Comment #2
itangalo commentedI think rule sets are a bit clumsy in some circumstances, but your argument wins. Thanks for the reply!
Comment #3
AndrzejG commented@fago - Do You mean components or "normal" Rules also keep a variable?
(It is necessary to mention this important feature in the documentation!)
Comment #4
mitchell commentedUpdated component.