clara

http://www.clara-rules.org/
yenda 2020-09-22T16:45:08.001500Z

Is there a way to have async code in the LHS of a rule? It looks like because a go block returns immediately, if one tries to insert! a fact in the go block on the LHS of a rule, the insert throws an error because the context is gone

sparkofreason 2020-09-22T18:52:19.002200Z

Pretty sure the answer is "no". Why do you want a go-block in the LHS? Maybe there's another way to accomplish what you need.

yenda 2020-09-22T21:06:26.002500Z

I need to do some async calls to get some info from an api

ethanc 2020-09-22T21:07:41.004900Z

Doing stateful things within the rules themselves can lead to bizzare behaviors

yenda 2020-09-22T21:08:13.005700Z

if I can't do it I suppose the way around that is to insert a fact that will describe the api call that needs to be done, query for that fact, insert more fact based on that result then fire rules again?

👍 1
ethanc 2020-09-22T21:10:39.007700Z

that would likely be the recommended approach, clara works on the presence or absence of non mutating facts and assertions. When stuff starts changing beneath it, truth maintenance starts to break down

👍 2