Duplicate result bindings in rules should cause an exception
The following rule compiles and a session with it executes:
(defrule sample-should-fail-rule
[?binding <- Cold]
[?binding <- Hot]
=>
(insert! (->LousyWeather)))
This repetition of result bindings between different conditions seems fundamentally nonsensical to me. I found a case in our codebase where we had rules like this being automatically generated. Obviously this is a defect in our code's use of Clara, but ideally Clara wouldn't accept rules like this even if users mistakenly create them.
+1
As noted on https://github.com/cerner/clara-rules/pull/467#issuecomment-788699735 it looks like the engine did have behaviour, that while arguably undesirable, isn't exactly nonsensical - equality between the duplicated bindings does seem to be enforced. In terms of linting, I think any enhancements can be added in the clj-kondo hooks added in https://github.com/cerner/clara-rules/pull/482 ; a separate linting layer seems superfluous in my opinion. I'm closing this issue and the PR https://github.com/cerner/clara-rules/pull/467 but we can discuss if there is disagreement. In any case the PR has been stale for over 2 years now.