@mikerod can probably correct me here, but i believe that clara’s compiler already tries to share common constraints within the same session.
Yeah, I believe that common constraints are checked for and can end up being shared nodes on the rulebase network
So typically, I guess the idea is you don’t need to be overly concerned with “redundancy” in that respect - however, there are clearly times when you want to extract rules to help eliminate large numbers of facts coming into multi-way joins
Oh, yeah, I didn't mean for performance--I didn't make that clear above. I'm really thinking more in terms of readability for humans (i.e. automatically find a common abstraction to make it easier to understand all your rules). It's nice to know constraints become shared nodes though!
i haven’t really thought about static analysis of the rules written in the DSL, its an interesting thought. In general it would be nice to have analysis tools that would guide rule developers in the right direction with regards to patterns.
we did write some extra higher-level DSLs in some cases
to abstract away common rule patterns
so that’s something to consider sometimes