Fork me on GitHub
#clara
<
2017-08-31
>
dadair16:08:51

is it safe to call insert! from different threads? e.g., within a future? I have a way to not need this (e.g., gather data with the future and then insert! from the main thread), I'm more just curious.

mikerod17:08:21

@dadair I think that is a sort of tough question

mikerod17:08:32

It seems dangerous to assume semantically

mikerod17:08:03

I do think that implementation-wise, as long as every thread has fully completed their r/insert! prior to r/fire-rules it may work

mikerod17:08:12

That isn’t to say I think it is a supported use-case

mikerod17:08:49

So in general, during the “fire rules loop” cycle of the rules engine, the memory is in a mutable state

mikerod17:08:32

This is done primarily for performance. The caller perceives the working memory to be a persistent, immutable data structure that is returned after each call to r/fire-rules on a given sesion

mikerod17:08:11

However, r/insert! (and a few other similar ones) is called from rule RHS’s. That means it is sort of in that “fire rules loop” part of the lifecycle

dadair17:08:34

yeah that makes sense, I thought as much

souenzzo21:08:28

accumulators respect saliency?

wparker23:08:27

@souenzzo salience controls when a rule RHS (right-hand side, or consequence in other terms) fires; whether an accumulator is in the rule doesn’t impact it either way. It won’t control the time you actually run the accumulator, though I’m not sure why you’d want to do that.