This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-08-22
Channels
- # announcements (9)
- # beginners (96)
- # calva (14)
- # cider (49)
- # clj-kondo (29)
- # cljsrn (5)
- # clojure (55)
- # clojure-dev (37)
- # clojure-europe (4)
- # clojure-italy (4)
- # clojure-nl (5)
- # clojure-spec (5)
- # clojure-switzerland (3)
- # clojure-uk (5)
- # clojurescript (172)
- # cursive (14)
- # datomic (3)
- # duct (1)
- # emacs (6)
- # fulcro (17)
- # jobs (1)
- # leiningen (6)
- # nrepl (11)
- # off-topic (26)
- # pedestal (2)
- # re-frame (20)
- # reagent (9)
- # remote-jobs (3)
- # shadow-cljs (67)
- # spacemacs (24)
- # specter (6)
- # test-check (3)
- # tools-deps (18)
Is there an easy way to determine how much time each namespace is contributing to a require
? I have a require that is taking a long time and I suspect some transitive require has a slow top-level form
you can add :verbose to a top-level require and it will print for each one it loads transitively
might be able to just spot it from watching
is core.async in there? if so, that's it :)
How does clojure handle dynamically extending types to implement new protocols? This is impossible to do in java. Does it compile somehow to branching code that emulates the behavior, or does the JVM have dynamic type extension built in?
the code is here if you want to check it out https://github.com/clojure/clojure/blob/master/src/clj/clojure/core_deftype.clj#L506
I do not have this process terribly well understood myself, but roughly there is a map for each protocol (and perhaps each protocol function) that you define, and this contains a cache of the correct function to call based upon the class of the first parameter. These get updated when extend-protocol and/or extend-type are called (perhaps one or two others I am forgetting). There are special (but reasonably common) cases where the Java method call lookup machinery is enough, e.g. if you define the protocol function implementations when you call deftype.
That started right - a protocol is a map of types to function impls. The caching happens per call-site though, not in the protocol
what's a good way to check if something is amenable to adding metadata?
user> (instance? clojure.lang.IObj list)
true
user> (with-meta list {:a 1})
UnsupportedOperationException clojure.lang.PersistentList$Primordial.withMeta (PersistentList.java:58)
list
is the odd one out, but I mean nothing prevents you from (reify clojure.lang.IObj)
aswell
in your code above, is list
literally the list
function? or is list
bound to an actual list instance?
is there a database that works like clojure's data structures? (keeping track only of the differences)
(to some degree, really more complicated than that)
what is the best way to receive a file via stdin in a clojure console application using leininger?
@lucelios Yes, we use New Relic heavily in production with Clojure backend processes. Do you have a specific question?
Hi Sean! We are having difficulty with cross-application traces... We use aleph.http for requests and New Relic headers are not being added automatically. Did you have to experience something like that?
New Relic's support for non-mainstream HTTP clients and servers is less than stellar. We started out with http-kit as our server and after various tweaks and working with NR support for a while, we gave up and switched to Jetty instead (and, even then, we had to test a few versions to establish which ones they fully supported).
For requests, we use a mixture of clj-http and http-kit (client). Both of those seem to work fine with distributed traces and tracking external services -- but it's entirely possible NR doesn't know how to track HTTP requests made with Aleph (and so it doesn't add headers automatically).
hmmm I see.. Do you know a good way of adding X-NewRelic-App-Data header into the response?
I'd have to know quite a bit more about your app -- how the services are built and how they're called, since you're going to need to do this manually. I've never used Aleph.
@vale Is this what you're looking for? https://walkable.gitlab.io/
Does a Go implementation of Clojure make sense given they both use CSP, and if that's possible could that raise clojure's popularity?
@thomasskinner76 I doubt that a Go implementation would be anywhere near as widely used as the current JVM-based version...
clojure would perform very poorly with go's vm, clojure really demands a lot from the GC
Is Go's GC far behind the JVM's? I'd greatly appreciate any resources for me to learn more about this.
it's a different style of GC, and it doesn't handle the specific case of massive amounts of short lived objects the way the JVM does
for idiomatic Go code, it works very well if tuned correctly for your domain, but it doesn't really match the way idiomatic clojure code uses local immutable values that quickly leave scope
I mean, go code is usually faster than java, but that's more due to mechanical sympathy than advanced vm tech
and clojure opts out from that kind of mechanical sympathy - trading it for the semantic guarantees of immutables
(and core.async
implements "CSP" by rewriting code at the Clojure level so a "Go implementation of Clojure" wouldn't address that)
in fact if CSP was in clojure's core core.async would probably be less awkward - not that we should do that or anything
We have actually talked about making the analysis parts of the compiler available in a way such that core.async could use it rather than reimplementing it in a macro, which would also make it a lot less awkward
But prob not something happening soon
that would make core.async much nicer
that's interesting. What does Go's VM lack for clojure that would be needed? It somehow has better GC?
Go has a mediocre gc, compared to the jvm - specifically in terms of performance. Clojure's usage of immutable data creates a lot of short lived garbage.
supposedly light weight threads as a vm feature are coming to the jvm, but I will believe it when I can deploy it
go is also largely a static runtime, which makes using a language with dynamic code loading annoying
Oh I see. So the performance of Go which is generally supposed to be very good, is partially only that way because people use mutable state, instead of programming functionally. Is that right @noisesmith ?
(also concurrent ml's model of synchronizing on events is a super set of go's channels, and way cool)
@thomasskinner76 it might be more straightforward to say that the jvm is unique among vms (or relatively unique) in having a short term garbage collector that allows operations on immutable data structures to be performant