This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-11-21
Channels
- # announcements (1)
- # beginners (20)
- # biff (5)
- # calva (43)
- # cider (5)
- # clj-commons (7)
- # clj-kondo (11)
- # clojure (58)
- # clojure-brasil (1)
- # clojure-denmark (1)
- # clojure-europe (27)
- # clojure-nl (1)
- # clojure-norway (13)
- # clojure-uk (2)
- # clojurescript (71)
- # data-science (32)
- # datalevin (6)
- # datomic (19)
- # emacs (1)
- # gratitude (3)
- # honeysql (8)
- # hoplon (15)
- # hyperfiddle (3)
- # introduce-yourself (1)
- # lsp (19)
- # malli (4)
- # nbb (7)
- # other-lisps (5)
- # practicalli (1)
- # re-frame (14)
- # releases (1)
- # ring-swagger (1)
- # squint (118)
- # xtdb (9)
- # yada (2)
Flow news:
• Removed :init
, since we couldn't think of a strong enough use-case
• https://day8.github.io/re-frame/FAQs/UseASubscriptionInAnEventHandler/:
◦ Consolidated the other js/event faq page
◦ Wrote a more thorough problem description
◦ Added more solutions (like flows and polymorphic subs)
• Tweaked naming - flow<-
, get-flow
• Lots of code refactoring & docs proofreading
Can someone explain to me the use of ::
keywords, or point me to documentation about their use in re-frame?
I keep getting a warning that I don't have a subscription handler. In my subs
namespace I have (reg-sub :server)
and in views
that is getting referenced as (subscribe ::sub/server)
. Is that correct?
See https://clojure.org/reference/reader#_literals -- "A keyword that begins with two colons is auto-resolved in the current namespace to a qualified keyword"
Or are you asking a different question? ::sub/server
will resolve sub
to its namespace alias, so you'll have :
(so :server
is not a qualified keyword and therefore not the same as ::sub/server
)
If I change the subscription to just :server
or the reg-sub to ::server
the console spits out a ton of errors.
::server
means "resolve in the current ns" -- so it also produces a qualified keyword.
You need to be consistent and use ::sub/server
everywhere and have the same require :as sub
alias everywhere you need to use it.
I got it going again. Needed to properly deref the subscription. Took me a minute to figure out where the error was in the stack trace.
One good reason to namespace your handler keys is to avoid collisions. There are a bunch of https://day8.github.io/re-frame/External-Resources/ providing handlers, and explicit ownership of names allows for seamless integration. Also, once you get used to it, namespacing adds a https://github.com/matthiasn/talk-transcripts/blob/master/Hickey_Rich/MaybeNot.md?plain=1#L425 https://github.com/matthiasn/talk-transcripts/blob/master/Hickey_Rich/MaybeNot.md?plain=1#L1026 https://github.com/matthiasn/talk-transcripts/blob/master/Hickey_Rich/MaybeNot.md?plain=1#L1202 to problem solving. Once you start being explicit about what things are, a lot of the code you thought you needed to validate, interpret and conform these things can just go away.
IMO the crucial DX arrived in clojure 1.11 with https://clojuredocs.org/clojure.core/require#example-653bbcc569fbcc0c226173f6. This lets you decouple ownership of names from code execution dependencies. That's how you can articulate re-frame's global virtual machine very conveniently & concisely.