Fork me on GitHub
#clara
<
2018-06-29
>
Daniel Hines19:06:12

Hello all. What is the current status of dynamically generated rules in CLJS with Clara? I saw this thread: https://groups.google.com/forum/#!topic/clara-rules/9x-dIBM1hoo, but the last bit of activity was several years ago, and I can't tell where things landed.

mikerod20:06:40

@d4hines I don’t know of any activity on it really

mikerod20:06:51

Rules are compiled in clj. The compiler uses eval

mikerod20:06:16

What are you wanting to explore in this regard?

Daniel Hines20:06:38

I know a major goal of Clara is to "take back rules for the developer", but a major goal of a project I'm working on is to be able to update rules on the fly based on changing business logic. The rules aren't that complicated at all, but there are a lot of them, so it would be nice to create an interface for a non-developer to edit and publish the rules. It sounds like that would require deploying a new build, correct?

mikerod20:06:48

The thread you linked to discussed it some, but you could have a server that compilers rules and sends it back to client

mikerod20:06:54

if you are wanting to have a client in cljs

mikerod20:06:20

Not sure what your non-developer constraints are - what would they be editing in?

mikerod20:06:34

eg (1) a repl (2) some sort of browser-based UI etc

Daniel Hines20:06:49

Well, I was definitely leaning towards (2), but having seen an example of instaparse creating clara rules, it might be neat to create a dsl such that the source of truth for the rules is a text file, in which case a fancy UI might not be as necessary.

mikerod20:06:10

You can make rulesets in a dynamic way

mikerod20:06:15

So bring in some text files, convert format to Clara rules data format, compile them (and ensure you have the right compiling-context for var resolution etc)

mikerod20:06:30

You can do mk-session with collections of rule/query structures

mikerod20:06:43

So they do not have to be bound to Clojure namespaces/vars

mikerod20:06:03

So you could build a more dynamic process around that.

Daniel Hines20:06:16

I'm not sure I follow, but that's probably due to my unfamiliarity with Clara in general.

mikerod21:06:59

I can try to come up with an example

dominicm21:06:30

Does self hosted Clojure script work?

mikerod21:06:53

some Clara namespaces are only clj

mikerod21:06:58

(not cljc)

mikerod21:06:08

It’d be cool to make it self-host compatible though 😛

mikerod21:06:25

adds a bit of a new layer of trickiness to parts of it, macros etc

dominicm21:06:44

Yeah. There's some help for that in macrovich

mikerod21:06:55

yep, I’ve seen that one

mikerod21:06:29

If I had more time to do it, I’d definitely look at self-hosted support. Would be cool.

mikerod21:06:44

It probably isn’t a terribly long way off, but I’m sure there would be some trickiness