-
Notifications
You must be signed in to change notification settings - Fork 0
Description
It might be better to simplify things by removing the set-logic, and just rely on Boolean logic. That's a hard choice to make b/c the set-logic system was the essence of the "ah ha" moment that led to this project, and in-itself it is very cool and makes a hell of a lot of sense. The problem is, as it turns out, the degree of flexibility it provide is almost never needed.
For example, lets say we have two facts (or states, for older versions). We can write it either of two ways. Like this:
fact :need_docs? do
...
end
fact :has_manpages? do
...
end
rule need_docs? & has_manpages? do
...
endOr like this:
def need_docs? do
...
end
def has_manpages? do
...
end
rule fact(:need_docs?) & fact(:has_manpages?) do
...
endBut we really don't need to go to all that trouble because we could just define a separate fact that combines the other two in it's definition. Like so:
def need_docs?
...
end
def has_manpages?
...
end
def run_ronn?
needs_docs? && has_manpages?
end
rule :run_ronn? => :run_ronn Notice there is no need for the fact method at all. Moreover we can extend the rule method to at least handle simple AND conjunctions, like this:
rule :needs_docs?, :has_manpages? => :run_ronnWe could still keep the set-logic system under the hood. It wouldn't hurt anything to have and it may still be of some use in combining file-facts. If in the end, that too proves to be unnecessary then we can remove it altogether.