There hasn't really been much of a call for it in the past actually. Normally flow control has a better solution then forcing things to happen in a certain order.
I think the ideal solution to that is backwards chaining, which is something we want to do. So a rule can request that the calculation be done, and it is done just once (and only when/if it is needed to complete a rules LHS). This is something we are looking at doing very soon as it has lots of other uses. On 3/20/06, Jayaram C S <[EMAIL PROTECTED]> wrote: > > > > Michael Neale <michael.neale <at> gmail.com> writes: > > > > > No I don't think there has been much discussion in it in Drools 3 (but > feel > > free to start one ! thats what this list is for). > > > > But on the topic of what you want: you want some "calculation" to be > > performed once, and the results of that calculation used in subsequent > > rules. This is a reasonably common thing. What I would suggest trying is > to > > create an object specifically to hold the results of that "calculation" > > (which is just pulling things out of a list). You can then bootstrap > that > > calculation by having a rule with higher salience take the ShoppingList, > > extract the vitamins, and assert them to the rule engine as a seperate > > object (VitaminList??). > > > > You can then have other rules depend on that vitamin list being there. > That > > way all the rules that depend on vitamin list will be able to be > checked, > > yet the list is only calculated once (which will always happen first). > > Further down the track you may have a rule that changes that vitamin > list, > > thus requiring the rules to be evaluated again, so its not a bad > approach to > > try. > > > > Michael. > > > > --------------------------------------------- > > > > > > > Yes, holding the results of custom function calls in intermediate objects > is > certainly the way to go about while dealing with computed temporary > values. > > But initialization call still needs to be done from a bootstrapping rule > seems > to be a very unnatural way of doing it. Well may be we can look forward to > seeing such features like initialization calls,destruction calls etc > futute > versions > > > Regards > Jayaram > > > >
