This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-09-22
Channels
- # alda (1)
- # aws-lambda (23)
- # beginners (27)
- # boot (156)
- # business (2)
- # carry (4)
- # cider (1)
- # cljsjs (2)
- # cljsrn (29)
- # clojure (170)
- # clojure-austin (35)
- # clojure-czech (8)
- # clojure-dusseldorf (5)
- # clojure-italy (4)
- # clojure-nl (1)
- # clojure-quebec (2)
- # clojure-russia (45)
- # clojure-spec (49)
- # clojure-uk (12)
- # clojurescript (81)
- # component (5)
- # datomic (24)
- # devcards (26)
- # emacs (4)
- # hoplon (4)
- # jobs (1)
- # juxt (5)
- # leiningen (6)
- # luminus (14)
- # mount (26)
- # om (27)
- # om-next (2)
- # onyx (22)
- # pedestal (2)
- # planck (3)
- # proton (5)
- # re-frame (19)
- # reagent (2)
- # ring-swagger (60)
- # spacemacs (12)
- # specter (8)
- # untangled (119)
- # vim (61)
- # yada (36)
Having:
(defrecord Component []
component/Lifecycle
(start [component] (println "started"))
(stop [component] (println "stopped")))
(defn start []
(component/start
(component/system-map
:comp (map->Component {}))))
and running on the repl:
user> (def r (start))
started
#'user/r
user> r
#<SystemMap>
user> (component/stop-system r)
clojure.lang.ExceptionInfo: Component :comp was nil in system; maybe it returned nil from start or stop"*
(map->Component {})
is not nil
, so why is :comp nil
?
I'm busy trying out component
to manage state in a part of my application: I've got an application and I want to use component for a part of it.
I know component is supposed to be used in all parts of the application, but refactoring it in one go may take too long. I want to do it step by step, and probably not even for all parts (I don't really like 'lib/framework buy-in', and it is supposed to be possible to use component
only for a part of the application).because println in your start returns nil, that is taken as the started state of your component
🙂 makes sense.