This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-11-29
Channels
- # adventofcode (11)
- # aws (2)
- # bangalore-clj (8)
- # beginners (92)
- # boot (2)
- # calva (26)
- # cider (1)
- # clj-kondo (4)
- # cljs-dev (4)
- # clojure (54)
- # clojure-berlin (5)
- # clojure-houston (6)
- # clojure-italy (12)
- # clojure-nl (7)
- # clojure-uk (39)
- # clojurescript (12)
- # clojutre (6)
- # cryogen (1)
- # cursive (15)
- # datomic (11)
- # duct (1)
- # events (5)
- # fulcro (14)
- # jackdaw (1)
- # joker (2)
- # malli (15)
- # mental-health (1)
- # off-topic (35)
- # reagent (2)
- # reitit (24)
- # rewrite-clj (3)
- # shadow-cljs (19)
- # vim (11)
Anyone with experience with https://github.com/sunng87/diehard ? I have a "process" (single thread actually) that pulls data from SQS. In the event that SQS or network falls over transiently, I'd like to back off and retry a little bit later. A circuit breaker seems like a useful abstraction...
@U7PBP4UVA https://github.com/ylgrgyq/resilience-for-clojure is a more modern library with similar features.
When using reify with a Java interface, is there some way to store state on this, or do I need to keep state eg in a separate atom?
fwiw, the following pattern works:
(let [a (atom nil)]
(reify ...))
i.e. the atom is not very disjointed from the reify. This is documented: ...and can refer to the surrounding local scope
yeah, this is what I did. just felt a little awkward
at the same time, imagine had to choose (and impose!) a specific state model implicit in
reify
bodies... e.g. built-in atom? or built-in Java volatiles? tough choice
yup, probably makes sense
Are there any tutorials/details on how to deploy a JAR/WAR to an Azure app service? (I can't use another cloud provider due to client limitations) Deploying WARs on Tomcat keeps stopping me as there's no services folder under META-INF. If that's manually added to the META-INF I get a lot of truncated class errors or ClassNotFoundExceptions, despite them appearing in the extracted WAR Deploying a JAR seems to just die and I can't figure out why yet The couple of things written on the subject are either "just host a VM" or are around using the Azure webapp maven plugin, which I don't understand how to interface with Lein/whatever other loader I need to use Any help is appreciated
Given a coordinate vector such as '[lambdaisland/deep-diff "0.0-29"]
, is there a handy function that will print its description? Ideally fetching it from ~/.m2
, for speed
Would you expect this to work?
(->> values
(map async-fn)
a/merge
(a/into {})
a/go)

if I would publish a library with java code that uses clojure.lang.RT and that lib would for example depend on 1.9, will that library be usable in a project which depends on clojure 1.10?
In general there is no promise by the Clojure core team that such things will work. They do not consider clojure.lang.RT as part of the public API of Clojure's implementation.
In practice, it will often work between two consecutive Clojure versions, but you don't have cause for complaints or bug filing if it doesn't.
Generally, yes. Calls to RT get embedded into aotโed code so as a general policy we only ever make additive changes to it (I canโt remember an exception to that in the last 7 yrs at least)
@U04V15CAJ Why use clojure.lang.RT
when you have https://clojure.github.io/clojure/javadoc/clojure/java/api/Clojure.html which is a public, supported API?
@U04V70XH6 because I needed the unpublic API to replicate some behavior of Vars, but it turns out I can do it in Clojure itself ๐ https://github.com/borkdude/sci/blob/e2a875b6856426d3ced11f11f01266c81406ad49/src/sci/impl/vars.cljc#L145
I recently asked for consuming server-sent events from Clojure. There was little help to find, so now there is this: https://github.com/cjohansen/clj-event-source
this library calls join on a thread inside a go block, which is a very bad thing
you could fix it by calling thread
instead of go
at the end of connect, otherwise this code can deadlock all of core.async just by having enough requests in flight
https://github.com/cjohansen/clj-event-source/blob/master/src/clj_event_source/core/async.clj#L42
in fact, you don't even need thread
, you could just use future
, as that body doesn't need any core.async features
cool, thanks
that's pretty damn fast code review ๐
I'm debating whether I'm too lazy to create an issue on htis lib haha
It's OK, I'll just fix it immediately
it's easy because everybody predictably makes this mistake
ahh! I didn't realize it was your code until just now
it is ๐
so basically replace go
with future
, and that's it?
right - the gotcha with future (and thread) are that they can leave failures in limbo, but the try catch you already have addresses this
I have very limited experience with Java futures ๐
I did test it. It's basically there to catch connection problems
the future
macro takes arbitrary code in an implicit do, and ensures that it runs in a new thread with clojure bindings conveyed for dynamic vars
right - this code works great for < N connections, then with N connections in flight all of core.async stops
but future (and async/thread) uses a cached expandable pool, which adresses this issue
thanks alot for the quick and detailed feedback!
and a minor style thing: instead of
(try (.join res) (close! port) (catch ... (close! port)))
you can have
(try (.join res) (catch ...) (finally (close! port)))
ah, of course
unless the catch has to act on errors in (close! port)
- but in that case it shouldn't be trying to do it again, right?
no, the close here is just a best effort really
if you already closed it, you're doing some strange stuff, and if it's closed, it's closed
alright, new version on Clojars and github, thanks again ๐
it uses the http://java.net.http stuff from Java 11
I want to add two methods to a deftype
, e.g.:
(defprotocol IBox
(setVal [_ _])
(getVal [_]))
But I want to keep IBox
private, is that possible?impl
folder pattern? https://github.com/clojure/core.async/blob/16d8cc792a297aa1d35b4f7f974f2d801cd443f8/src/main/clojure/cljs/core/async/impl/protocols.cljs
I do not know if it works for anything other than def
and defn
, but did you try adding ^:private
metadata to the name?
โ Does someone happen to have a copy of Enter Integrant
by @weavejester? It looks like the company hosting the video linked in the Integrant repo has gone under administration: https://skillsmatter.com/skillscasts/9820-enter-integrant - sad, and it looks like there's replacement talks out there that aren't this talk (including by @weavejester), but it would nice to preserve it, though I don't know the IP rights around that video.
The loss of SkillsMatter has meant the loss of a lot of Clojure content online, unfortunately ๐