This page last changed on Sep 12, 2013 by juha.

Hey folks! I'm posting some threads of discussion I had with Juhan in case anyone is interested or would like to chime in. I'm pasting them in here, but please feel free to respond below as if this were a normal thread!

Isaac wrote:
You didn't mention these but I saw some when I clicked through your cron link. For example:
when eval(true)
This example isn't heinous, but eval statements should really be avoided at all costs. They are actually deprecated in drools 5.5, if I recall correctly. Their use breaks the rete algorithm by preventing caching of the results. This statement should probably just be written as "when then". I'm pretty sure an empty "when" is implicitly true.

Juhan wrote:
You are right, an empty when condition evaluates true. This is just one of those small things. A programmer may appreciate the brevity of implicit logic. To your regular user it just causes additional confusion. While you can say:

rule "Foo"
  timer (cron: 0 0 17 MON-FRI * ?) when then doSomething();
end

The above just creates more questions when you read it out loud ("when then" ?). But you are probably well aware, since you work in NLP So I've chosen to be more explicit in the example to reduce questions about cryptic implicit syntax and say:

rule "Foo"
  timer (cron: 0 0 17 MON-FRI * ?) when eval (true) then doSomething();
end

It just reads better in English. And makes the point that the timer execution can still be conditional on facts in the working memory, not strictly only based on clock.

I'm not sure if Drools allows dropping the 'when' keyword altogether so we'd get a more appropriate:

rule "Foo"
  timer (cron: 0 0 17 MON-FRI * ?) then doSomething();
end

But thinking through the templating I guess we could modify it to something like:

rule "Foo"
  Timer on MON-FRI at 17 hours 00 minutes do something();
end

I'll need to go back and look at templating. I had completely forgotten about using it as an option.

Isaac wrote:
I think that working with drools templating is a great idea. I've only read about it myself, never implemented. I'll go refresh my memory about it once some of the more pressing issues are dealt with.

Document generated by Confluence on Jun 05, 2016 09:30