This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-10-17
Channels
- # announcements (1)
- # asami (3)
- # babashka (10)
- # beginners (61)
- # calva (60)
- # clojure (47)
- # clojure-nl (3)
- # clojure-uk (10)
- # clojurescript (36)
- # conjure (18)
- # cursive (4)
- # datomic (25)
- # fulcro (21)
- # luminus (1)
- # malli (25)
- # off-topic (26)
- # pathom (2)
- # portal (55)
- # re-frame (1)
- # reagent (7)
- # sci (1)
- # shadow-cljs (25)
- # sim-testing (2)
- # sql (14)
- # vim (6)
- # xtdb (10)
What's a good word for the category "socket" vs "stdin/stdout" and another word for the category "edn"/"json"? The latter I would call format. The first one I would call... channel? don't know!
Use case: I have software communicating either via sockets or stdin/stdout and exchanging messages in edn/json, so I need something like this:
{:??? :socket :format :edn}
I came across this word in the nREPL docs but it seems they're using transport to describe the format rather than the socket mechanism
I do think that word is more fitting for the mechanism of transport rather than the format of the messages being transported
Transport is both in nrepl, the serialization mechanism is tied to the communication mechanism
are there any good hacker-news-esque "startup/programming fusion" slack/discord/chat rooms out there?
nothing like doing a little Java programming to make me re-appreciate the pure simplicity of Clojure!
Does anyone of you have a case of reify in their code with more than one interface/protocol?
I have a few, but this is probably the most straightforward, https://github.com/phronmophobic/membrane/blob/b265d9189a3a1a50e22d5be637ab099556e83673/src/membrane/java2d.clj#L775
https://github.com/phronmophobic/membrane/blob/09e14e3f152a53f47c257ada592f577f9d0328b7/src/membrane/ui.cljc#L289, it's used with ui code, but the purpose is to be able to memoize functions with potentially infinite lazy sequences as arguments which could be used outside of ui
and another example that hasn't been pushed publicly yet: in cljs
(reify
IPending
(-realized? [_]
(not (identical? @atm obj)))
IDeref
(-deref [_]
(let [val @atm]
(assert (not (identical? val obj)))
val)))
usage: it's meant to mimic a future. there's probably a better way to write it, but basically, I have some clj code I ported to cljc where I want a future that only gets deref'd once some async process is complete.
(let [obj (js/Object.)
atm (atom obj)
p (reify
IPending
(-realized? [_]
(not (identical? @atm obj)))
IDeref
(-deref [_]
(let [val @atm]
(assert (not (identical? val obj)))
val)))]
(async/go
(let [rendered (<! (-render-elems params elems))
error? (= :error elems)]
(when-not error?
(builder-dispatch :set $current-render [elems params rendered]))
(reset! atm elems)))
p)
elsewhere:
(if (realized? p)
@p
(ui/label "loading..."))
https://github.com/schmee/daguerreo/blob/master/src/daguerreo/impl/engine.clj#L336-L354
Eight reify
's in this file. This one is the biggest: https://github.com/seancorfield/next-jdbc/blob/develop/src/next/jdbc/result_set.clj#L483