oops meant to Cc to the list.
-------- Original Message --------
Subject: Re: [pcp] RFC - pmie "ruleset" extension
Date: Tue, 24 Jun 2014 14:05:35 +1000
From: Ken McDonell <kenj@xxxxxxxxxxxxxxxx>
To: Nathan Scott <nathans@xxxxxxxxxx>
On 24/06/14 09:44, Nathan Scott wrote:
...
One issue was the way there isn't just true or false, there's also "maybe"
(first sample for a counter, or host is down) - what would be the approach
there? Would it just fall through into that final else catch-all branch?
Heh, that would be the one that says "OK" above? ;) Might need some other
syntax for that case?
Hmm had not thought of that. Let me "think out loud" ...
Let's assume there are 3 rules (so no else <action>) part ... now
composite ruleset behaves like a giant disjunction on the 3 rule
predicates, so the ruleset evaluates to a boolean. The 3-state boolean
logic we use dictates that the ruleset will be TRUE as soon as one
predicate is TRUE and FALSE if all predicates are FALSE ... so if no
predicate is TRUE and some are FALSE and some are DUNNO (aka "maybe")
then the ruleset will have the value DUNNO.
So I need 2 optional clauses after the set of rules ... the exiting ELSE
matches the FALSE case (but ELSE may not be appropriate semantically
now) and I need some other keyword for the DUNNO case.
For example ...
ruleset
rule1
else rule2
else rule3
else action1 if undefined
else action2;
There is nothing difficult about this in the execution engine ... it is
just a matter of making the grammar look OK (and I'm not sure the above
meets this criteria) ... suggestions more than welcome.
Actually that won't work at all ... "if" and "undefined" are ambiguous
... could be arguments to action1.
Perhaps no "else action" stuff, demand every element in the ruleset be a
rule, but add a new symbolic constant "dunno" or "maybe" or "undefined"
or ??? like the existing "true" and "false". This would allow the
explicit specification as follows:
ruleset
rule1
else rule2
else rule3
else dunno -> action1
else true -> action2;
Now this needs some special semantics for "dunno" in this context,
otherwise action1 could never be executed, but that's easy in the engine.
|