Fork me on GitHub

@xiongtx often the best is not to AOT at all


avoids a whole class of issues


I like to just java -cp my-uberjar.jar clojure.main -e "(require 'my.core)" -e "(my.core/main)"


Or even java -cp my-uberjar.jar clojure.main -m my.core


of course you may have some specific reasons for AOT'ing but if it's just about running an uberjar, this will work


@dominicm, ah I didn't know about that

👍 4

What's the recommended way to do some asynchronous network io in a ring handler e.g. write to some log without slowing down the response?


I thought about just launching a future, but wondered if there is a more robust method


@danielstockton you could use a java.util.concurrent BlockingQueue


one one of the other queues provided by that package

👍 4

read-string in production : In general, how safe (stability/robustness-wise) is to run eval or read-string in production on regular basis in multithreaded environment? Say multiple threads are reading different strings... In terms of performance, what will be the main hit? Would that be the compilation? Is there any disk i/o? Is there any serialization happening? There is none, right? Also should I expect any significant memory growth over time or anything GC wouldn't handle?

Alex Miller (Clojure team)14:05:37

re safe: depends on where the string is coming from (if a user, it’s not, but see clojure.edn/read-string for better)

Alex Miller (Clojure team)14:05:50

re threading: no worries

Alex Miller (Clojure team)14:05:11

re perf: reading and compilation. no disk i/o, it will be in memory. no serialization.

Alex Miller (Clojure team)14:05:28

classes can generally get GC’ed if not in use. there are a couple of obscure bugs related to eval. prob unlikely you’ll hit those, but test to make sure.


@alexmiller thanks! yeah I meant safe in terms of robustness (security risks are clear here I guess). that all sounds good! in terms of compilation overhead - I ran some tests with small snippets of code and was surprised that the hit was quite unsubstantial, just couple of ms here and there... Are you aware of any conditions under which that would change significantly (i.e. orders of magnitude)? Just size of the code?

Alex Miller (Clojure team)14:05:20

mo’ code, mo’ time

👍 12

How long have you been waiting to say that?


can you partial a defmulti?


the answer is yes. cool


Has anyone had luck using deps.edn to pull in private git repos with lein


is there away to access the local bindings of a closure? I posted my question here!topic/clojure/iQVBiYcSvmk


there's hacks to access it but nothing officially supported or likely to work across clojure versions


so effectively no


@noisesmith thanks. disappointing.... do you have any ideas on how I can do it?


for debugging there's libraries that alter the clojure compiler to make that accessible while stepping code


what are some cool libs you guys use for tests beyond bog standard clojure.test

Drew Verlee18:05:54

Clojure test probably gets the market share and has the most integrations with various editors. The only other i know of it Midje. Which i’m not sure is worth breaking convention for

Drew Verlee18:05:40

YMMV but i tend to not write as many tests in clojure, so the testing framework seems a bit less important. This approach is also somewhat different then clojure test


thanks, I'll look into it


@U66G3SGP5 I like (and maintain) Expectations for a more BDD style of test -- that is compatible with clojure.test and all that tooling.

(defexpect test-name
  (expect pos? (compute-something 42))
  (expect IllegalArgumentException (blow-up 13)))


Where Expectations shines is that you can expect "more of" an expression with destructuring and predicates and so on. There's an #expectations channel here if you want to dig deeper.

Drew Verlee20:05:49

@U04V70XH6 Just looked at Expectations. Thats awesome, this feels like what i should default to using.


I saw a presentation on it, some years back, and switched everything at work from clojure.test to Expectations shortly after, except for our WebDriver tests (which were very procedural and "assert-y".


I need to finish the 2.2.0 release but I'm still in the process of rewriting the docs, to make defexpect the default approach.


And I still need to work on the reporting -- the clojure.test integrated stuff doesn't have the great error reporting that standalone Expectations has.


@noisesmith doyou think I can use dynamic binding to hack around this?


you could use a global dynamic var instead of a local, but that has its own drawbacks


or you could use a defrecord explicitly containing the value as a key, then you can access it like you could any value in a map

Shantanu Kumar03:05:40

@sonnyto Dime has such an implementation called dime.core/definj in case that helps to play with the idea.

👍 4

by implementing IFn the record can be called like a function


and it already acts like a map where you can see the keys in it


not a bad idea


of course that means instead of using a let binding it would use its own key, but that's simple enough


thanks. i'm going to experiment with that

Drew Verlee20:05:03

If you want to tell people, external tools, etc.. that a function is some combination of 1. not part of the public functionality 2. not the main goal of the library 3. wont be stable/ subject to change or go away So basically make it not really visible unless you go look at the raw code. Whats the best way to do that? I can make things private, but that seems to have more todo with namespaces, which isn’t really the same as the goals above


Under what conditions is a DynamicClassLoader created?

Drew Verlee20:05:53

i did a quick search and didn’t find anything. is there something special about .impl?


nope, just a convention


I'm trying to do boolean logic on sets. For example,

(and #{7 3} (or #{2 3} #{3 5 7 99}))


I get #{3 2} as a result for that one. Not exactly what I was expecting. Feel like I'm missing something fundamental about how to evaluate and-or logic in clojure for things like sets.


is and union and or intersection?


and and or just check truthy / falsey


you might want clojure.set/union and clojure.set/inersection


Oh I see. Well, how do I evaluate for overlap?


I might have swapped and and or there


Hey, thanks, that's exactly what I was looking for


you are correct, union = OR, intersection = AND


Awesome. Map magic makes what I thought would be a quick algorithm even quicker. wazoo.


Does anyone have a link to that article that was about using with-open and as an alternative to the Component library? Or a list of terms to google for


no idea but it smells like the kind of thing hiredman or ghadi would blog about


oh that does look like it - similar to plumatic's plumbing too


we’ve been using mount and very happy with it…