This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-09-26
Channels
- # announcements (3)
- # babashka (23)
- # beginners (54)
- # calva (9)
- # cider (8)
- # clj-kondo (18)
- # cljsrn (25)
- # clojure (69)
- # clojure-australia (1)
- # clojure-europe (7)
- # clojure-spec (13)
- # clojure-uk (1)
- # clojurescript (122)
- # conjure (8)
- # cursive (15)
- # defnpodcast (9)
- # deps-new (2)
- # emacs (22)
- # fulcro (10)
- # graalvm (36)
- # luminus (5)
- # meander (5)
- # minimallist (1)
- # observability (6)
- # off-topic (54)
- # reagent (8)
- # reitit (2)
- # releases (1)
- # reveal (25)
- # shadow-cljs (21)
- # tools-deps (50)
- # vrac (1)
- # xtdb (2)
Hey folks! Spent the last few weeks diving into Fulcro in my evening hours. Awesome stuff! I have a question that I haven't been able to figure out on my own: I am wondering if it is possible to define a new state machine at runtime. I want to take a domain-specific data-structure (entered by a user) and convert it into a state machine that I can then run. Is this possible?
it should be possible
take a look at the definitions of uism/defstatemachine
you'll see it adds the machine definition to a global registry key'd by a fully qualified symbol
so you'll have to do that yourself after building the machine (which is just a map)
and pass that machine definition into uism/begin!
now whether you really actually or should do that is a different matter
if you look at the source of RAD in com.fulcrologic.rad.form
you'll see a state machine that works for an arbitrary form with all kinds of customization options
and @U0CKQ19AQ did not need to dynamically define that machine at runtime
but again, depends on your use case
Yeah that's a good point. I may be able to create a machine that directly uses my domain-specific data without actually creating a whole custom machine every time. Appreciate your detailed response!