This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-03-14
Channels
- # announcements (10)
- # architecture (3)
- # atom-editor (1)
- # babashka (53)
- # babashka-sci-dev (118)
- # beginners (74)
- # biff (10)
- # calva (13)
- # clara (13)
- # clerk (20)
- # clj-commons (17)
- # clj-kondo (6)
- # cljdoc (19)
- # cljs-dev (3)
- # clojars (2)
- # clojure (63)
- # clojure-art (2)
- # clojure-europe (68)
- # clojure-nl (1)
- # clojure-norway (6)
- # clojure-uk (3)
- # clojured (19)
- # clojurescript (34)
- # clr (1)
- # cursive (11)
- # emacs (12)
- # fulcro (3)
- # helix (2)
- # holy-lambda (2)
- # honeysql (27)
- # hyperfiddle (36)
- # malli (2)
- # off-topic (72)
- # polylith (4)
- # rdf (20)
- # re-frame (20)
- # reitit (4)
- # rewrite-clj (14)
- # shadow-cljs (17)
- # slack-help (2)
- # tools-deps (36)
- # xtdb (3)
Hey, Is there any know tools for creating Clara rules from like a web UI. Aimed for non programmers to use.
Generally speaking, as the contract within the rules dsl is inclusive to CLJ and CLJS, clara isn’t really aimed at non programmers. That “raw language” api would be a concern for malicious code injection, which might dissuade people from having such a page… That being said, no, i am not aware of any such tools. If one did exist, i’d imagine it would hide it’s clara underbelly under a user friendly facade.
Thanks for the input! Yeah I guess it will hide that's Clara underneath. I think Clara is very well suited for it though as of the data model for rules and queries.
If you want a user approachable rules system, look at Drools. It has nice UI a web Ui as well, supports rules in a English like language, decision trees, and more. There are a few Clojure projects on GitHub. They are older but probably good to look at for how to interop using Clojure. https://drools.org/
Is this not possible in clojurescript because CLJS requires pre-defined rule sessions?
I’d likely have to defer to @U0LK1552A, but if i recall correctly the issue lies with the point in time when the arbitrary code forms have to be evaluated. On the CLJ/Java side, we are able to evaluate code on the fly at any point. The CLJS side is a little more of a blur to me, but i believe that it would likely attempt to try and eval code which isnt supported by default in CLJS but rather would have to require other workarounds/libraries that may/may not be ideal for consumers. Thus for the CLJS side of things, the current behavior requires the sessions to be defined at compilation time.
The CLJS side is special in clara indeed.
On the JS env, there is no clara compiler available - since it in turn uses the CLJS compiler and eval
.
CLJS sessions are made at macroexpansion time during CLJS compilation. The resulting expansion is code suitable for CLJS’s JS compilation.
I have had an open issue for some time to modernize this approach, but fundamentally I don’t think that’d break away from this constraint on how it works. See https://github.com/cerner/clara-rules/issues/388
A fully self-hosted sort of clara JS-env compiler would be interesting. It’d be quite a bit of work at this point though since the clara compiler would have to be written in cljc and have the host-specific parts written for the js-side.
Thanks for the responses! I did some digging in this channel historically and am looking into doing server-side compilation of the network as a possible option. Client rule changes will not be particularly often, so it may not be altogether tons of overhead to build server-side and dump to the client. I will post back if I get it working!
I wonder, could the need for eval be alleviated by using SCI?
I think my issue https://github.com/cerner/clara-rules/issues/388 mentioned above would have to be overhauled in order to explore other cljs tooling.