Fork me on GitHub

I've run into a strange compiler error that only seems to manifest when I pull in a secondary library via checkouts. I've verified the problem is not code as it works on another machine. Tried reinstalling java and Leiningen to no avail. Any idea what this could be?


user=> (require '[])
CompilerException java.lang.ExceptionInInitializerError, compiling:(


If I remove the symlink in checkouts, everything seems to work fine.

Alex Miller (Clojure team)02:06:38

frameworks are things that call you, rather than things you call

Alex Miller (Clojure team)02:06:47

(which are more likely components)


hmm, seems a reasonable defn

Alex Miller (Clojure team)02:06:46

not something I made up and probably not 100% satisfying, but I think it’s about right

tianshu04:06:41 I'm trying to deploy to private repo according to this tut, but every time I use lein deploy, It will ask for username and password. I mentioned it's said there's a bug for gpg, it that mean the username and password in credentials.clj.gpg will not work, orI have to do something?


Hey all, I am running into what I think is a bug with how clojure's java interop works


I am trying to wrap for use in clojure


but when I try to port the example upstart code


FileSource fileSource = new FileSource();
// SeaweedFS master server host
// SeaweedFS master server port
// Startup manager and listens for the change

FileTemplate template = new FileTemplate(fileSource.getConnection());
template.saveFileByStream("filename.doc", someFile);


(defn connect!
  [host port]
  (let [client (FileSource.)]
    (.setHost client host)
    (.setPort client port)
    (.startup client)
    (reset! client-atom client)
    (let [value (.getConnection @client-atom)]
      (reset! file-template-atom (FileTemplate. value)))))


I get an error similar to IllegalAccessError tried to access class org.lokra.seaweedfs.core.Connection from class <class info>


Any suggestions or workarounds I can try?


Plot thinkens, I can use the code without problems on my Mac but on Windows it breaks




@royalaid What's the Java version on both? lein version should print it


Also possibly compare the outputs of lein deps :tree

Alex Miller (Clojure team)12:06:09

I don't see any signs that CLJ-1243 has anything to do with it


hey guys! I want to read a stream with unknown number of lines (e.g. a file) and fire an async get request per each line (lets say using an http-kit async get with (go (>! c response)) as a callback). then, read the responses one by one into another file. is there an elegant way of closing the channel making sure I am not missing any async puts into the channel? I can do so with putting my own guard msg at the end but it feels awkward.


I'm not sure I understand what you're trying to do exactly; any reason why the producer can't just close the channel when the stream runs out?


@gaverhae the producer might close the channel before the last response is put there


How so? The producer being (in my mind) the single sequential process that reads from the stream and puts on the channel, it should be able to not close the channel before it's finished reading the stream


maybe you're missing a channel


read file -> channel -> http calls -> channel -> write file ?


if that's the general shape and you want to ensure some parallelism in the "calls" step, maybe look at what the pipeline functions have to offer in core.async?


I would suppose they already handle closing the channel in the right order


Can anyone either give me some thoughts or tell me the best place to ask about some architecture issue I'm trying to sort out? Long story short, I have a Clojure + Clojurescript web app that needs to extend itself as a desktop app and as a user-owned server (with web admin api) that can have user created functions (think add-ons, plug-ins, arbitrary user code). I'm trying to find the best way to implement these two new pieces that highlights ease of installation, extensibility, minimal system requirements, and shared codebase as much as possible. The desktop app itself is surely going to end up being electron-based. As far as the code, there's a "simulation" engine that I don't want to rewrite in multiple languages unless from scratch to be shared, and is currently in .cljs files. My ideas thus far are - Option 1: Write the user-run server in Clojurescript + Node.js (running on node.js as the server) with user-defined JavaScript functions that get called from Clojurescript/JavaScript, and expose the Clojurescript API via externs Option 2: Write the user-run server in Clojure and run a v8 instance where I eval anything written by users in pure JavaScript, returning and sending json to communicate (at the cost of some speed and cruft). Any other ideas or thoughts? Or anywhere someone can point me? Thanks.


@twicebaked - Don't have time to think deeply about this now, but your question strikes me as one that could be asked at the Clojure or Clojurescript subreddit. That way it's less likely to be buried by other conversations while people think about it.


Any news on when clojure.spec become part of core?


It won't. It's been split into its own library.


wasn’t it going to be merged in later, on a “when it’s done” kind of schedule (so after 1.9) ?


There's a good discussion about this on the latest defn podcast ( - with Stuart Halloway - it's not on the website yet but it's episode 23 - it's in the RSS

Alex Miller (Clojure team)17:06:03

the true answer is: we have not yet decided

Alex Miller (Clojure team)17:06:53

it is effectively part of core now as Clojure depends on spec.alpha. thus users of Clojure get both. Whether and when the two units of code are co-located will depend on how things unfold (but should not actually matter to users)


Hi, I'm trying to figure out how to do something that's embarrassingly simple, but im just having no luck lol. Basically, I need something that does the following

(check #{1 2} [1 2 3]) => true
(check #{1 2 4} [1 2 3]) => false
for check i've been through variations of some, every? not-any?, etc. But still can't quite get what I'm looking for . I just need to flag the fact that there's something in the first collection that's not in the second


convert 2nd arg to set?


are you looking for set equality or set subset?


not equality, just that "a has something that b doesn't" ,it's ok if b has somethign that a doesnt


yeah I guess set/difference would work too


the problem is that 'set b' may be large


subset sounds like it?


oh, you need one to be a proper subset of the other


so was wondering about the cost of converting from a list/vector to a set to do the comparison


but i think I'll just go with that for now


set uses transients, so don't think it would be a big overhead


ok wasnt sure how effcient it was in that scenario


(defn set
  "Returns a set of the distinct elements of coll."
  {:added "1.0"
   :static true}
  (if (set? coll)
    (with-meta coll nil)
    (if (instance? clojure.lang.IReduceInit coll)
      (persistent! (.reduce ^clojure.lang.IReduceInit coll conj! (transient #{})))
      (persistent! (reduce1 conj! (transient #{}) coll)))))


ok will give that a shot if it behaves then i'm good


I just jumped to definition in my emacs/cider (M-.) 🙂


so i guess it would be (and (subset my-set (set coll)) (not-empty? (remove my-set coll))


(not-empty? (set/difference (set a) (set b))) ?


that wouldn't ensure that a is a subset of b though


if the difference is empty, a is a subset of b


if you’re just trying to ensure a subset, can’t you just use set/subset? ?


But disjoint sets have a non empty difference which was certainly not according to his original requirements


@dpsutton he said "I just need to flag the fact that there's something in the first collection that's not in the second" -- disjoint sets certainly seem to fulfill that requirement, as there is definitely "something in the first collection that's not in the second"


what is the "best" way to store a c3p0 pool to be accessed by multiple namespaces?


mdrago1026: You can use something like or to manage complex required system dependencies. Or for something simple like a c3p0 pool, which keeps track of it’s own errors for the most part, I tend to just use something like (defonce conn-pool (delay (create-c3p0-connection)) and everywhere else you want to refer to it you can require the config namespace and reference the pool with @conn-pool


awesome. thanks a ton. I will take a look at these


@mdrago1026 on a very random, unsolicited side note, I prefer over c3p0. Nothing inherently wrong with c3p0, and I’ve used it in production quite a lot, but hikariCP fits better with what I’m used to in Clojure (in terms of “it just kind of does the correct thing”)


very interesting. let me read up on this. I've heard of Hikari and simply always default to c3p0 since that's what i always have used


way more than the speed of things (which is not insubstantial), this is why I prefer hikaricp:


wow this is neat


I'm going to try this out


Another piece of unsolicited advice: you should not think of namespaces as accessing anything; namespaces are passive collections of functions. And if a function needs access to a connection pool, it should receive it as an argument, regardless of what namespace it's in.


makes sense. I always got confused when it came to "sharing a connection" because everything else is functional and stateless, then comes the connection


I am looking for some help for code coverage tools for clojure, has anyone used cloverage before?


@payal worked fine last time I used, gave a nice report for lisp (based on forms covered)


just figured out why I am not able to get my tests goes through all well when I do lein test, but are failing when I use cloverage


@mdrago1026 Use defstate from, or look into BTW, do you need to stick with c3p0? I enjoyed quite a bit.


hansen-pansen: 😄 you and me? We’re on the same page, apparently…just different threads 😄


I felt quite ashamed that I sent the same advice hours later 😀


Oh, sorry for replying out-of-thread. 😳


@hansen-pansen No problem. I don't need c3p0 (used it before for work, so I just default to it). @tanzoniteblack also told me to look at hikari and it looks awesome. So thank you both


and mount and component both look great too


Is there a library that offers a worker-queue type of concurrency, i.e. enqueue work for a fixed-sized thread pool? I looked into claypoole, but it works on sequences.


hansen-pansen: if you’re familiar with java, you can do it the same ways you would in java with clojure. If I’m not too worried about thread priorities and contention, then I’ll just use core.async with a fixed number of “workers” (i.e. go-loops) that are pulling from a shared channel, and then write jobs to that channel


I already rolled a n00b-version with core.async, but it felt … too low-level. I looked into the amazing manifold, which offers backpressure and all the nice stream operators, but it lacks the pooling part. Just wondering whether somebody else stumbled over the same problem.


Ohh, and I have close to zero Java background, but if that is an option, I will take a look. I guess you mean something from java.util.concurrent?


agreed you can just use an ExecutorService


depends on your requirements. the main problem with core.async for worker pools can be that it uses the same thread pool for all core.async related channels. So if this is supposed to be a background operation, and you also use core.async in something like handling production web requests, then your background jobs might be interfering with your web requests. If that’s your case, you’ll probably want to use ExecutorService


but if you use core.async pipeline-blocking properly you can do it at a high level with clojure too


where the queue is the buffer on the chan, and the thread count is the parallelism arg


pipeline-blocking is what I used with my n00b version. And yes, I try to use concurrency mostly for background web requests.


Thanks to your ideas on this topic, I propably should just put more brains on the core.async/pipeline-blocking idea and think of some error-passing messaging or channel.

hansen-pansen21:06:20 brings me to some ideas. Thank you very much for your ideas and inspiration!


Thank you very much, guys! Your help is very much appreciated. This community is so cool!


So this function reflects


(defn test-reflect [^javax.servlet.http.HttpServletResponse resp]
  (proxy [] [(.getOutputStream resp)]
    (close []
      (proxy-super close)
      (println "hello"))))


specifically the call to proxy-super reflects


and I’m wondering why


it seems like it should be possible to resolve .close()


proxy doesn't type hint this


@michaelblume I was about to make a PR with a fix for that.


Assuming you're in ring; looks like it to me.


beat you to it =)


Did you get the rest? 😄


ring-servlet no longer reflects, didn’t check the other subprojects


That's what I had locally.


hmm, lein check runs cleanly for me with just what I have


Did for me, too, but I see the reflection in my project using ring.


So I chose not to trust lein check, since I can see in the source how it would be reflecting. 🙂


Interested in applying the other changes, as shown in my gist, to your PR?


I’ll look into it =)


oh, you’re in the jetty adapter, I see


ah, yeah, lein check reports problems


Ah, fair enough. Sanity is restored.


My approach to fixing the proxy-super is different, but the effect is the same.


@jeaye I also added a return type hint so my code wouldn’t reflect


Yep, saw that before I started on the reflection work.


That PR looks good; thanks for beating me to it and updating it for ring-jetty-adapter. 🙂


can you use environ when making a war file and deploying via tomcat? for example when i run lein with-profile dev ring uberwar... does that do anything?


very occasionally, 'clojure.core doesn't appear in the list returned by (loaded-libs). that would be a bug right?


hard to say


loaded-libs only contains namespaces loaded via require or use, if I recall


mmmm that's not really what the docstring implies


So I am using an exception tracker that has mediocre clojure support (Sentry), but I'm working to improve it. Exception "rollup" (grouping of exceptions based on their similarity) relies on the hash of "in-app" stack frames (frames that begin with com.myapp for instance) being equal to a previously seen exception's stack frames. I believe rollup is not working across runs of my application due to anonymous function names differing. So, for instance: com.myapp$fn__12345 is the name right now, but on the next run it may be com.myapp$fn__99999. Are there other patterns in clojure stack traces beyond$fn__12345 that I should let the maintainers know about which are specific to clojure, so exception rollup works as intended?


the way its sending the tracebacks seems to make Sentry happy (it manages to group by Exception type nicely)


@hcarvalhoaves I'm kind of meh on manually reading source files from disk with no cache and parsing the exception object by hand. This is something that can be accomplished on the server side.


As of a week ago or so, the getsentry folks picked up coda hale's wrapper around raven-java.


One other thing to add in case you're interested: I skipped the need to have in-app by simply setting the package names of my app as a param on the DSN


Finally, I spoke with the sentry maintainers and they said it would be no problem to just fix the hashing of the problematic frames.


@hcarvalhoaves err maybe one more thing: I tried variations on what you're using, and I still managed to have mixed results. I fixed that same nth IndexOutOfBoundsException for :context_line for instance. Here's the "official" sentry-clj lib now -- PRs as I understand it, are welcome:


IMO the killer feature is having source code context around the error


without that Sentry is just an expensive log aggregator