Fork me on GitHub
#clojure
<
2018-11-17
>
andy.fingerhut00:11:19

Sean Corfield: Clojure alpha tester by day, Clojure beta tester by night. 🙂

seancorfield00:11:20

Still day here 🙂

seancorfield00:11:55

And you know how much I just love to get new Clojure builds into production quickly!

andy.fingerhut00:11:51

I know you do it, for sure. I hope you love it, because otherwise you may be a bit touched in the head 🙂

andy.fingerhut00:11:19

From someone who resembles that remark.

seancorfield00:11:07

I will say that Clojure is the first technology I've worked with where it really is pretty sane/safe to take prerelease builds to production -- and we've been doing it successfully now for seven and a half years. I've worked with a lot of tech where that has just not been realistic!

andy.fingerhut00:11:35

I feel fortunate when, on occasion, I read stories about churn in JavaScript and other development ecosystems, that I don't spend my life with those particular frustrations.

seancorfield00:11:24

I still feel very burned by Scala (from the 2.7 -> 2.8 -> 2.9 fiasco).

andy.fingerhut01:11:21

World Singles: Deploying Clojure features before release since 2011.

andy.fingerhut01:11:57

Probably not a tag line your primary customer base will care about 🙂

4
beders02:11:21

I ❤️ Clojure and ClojureScript! That is all.

❤️ 8
borkdude08:11:24

Re: the set discussion

$ clj
Clojure 1.10.0-beta5
user=> (require '[clojure.set :as set])
nil
user=> (alter-var-root #'set/superset? (fn [raw] (fn [set1 set2] (raw (set set1) (set set2)))))
#object[user$eval3$fn__139$fn__140 0x4f2613d1 "user$eval3$fn__139$fn__140@4f2613d1"]
user=> (set/superset? [1 2 3 4] [1 2 3])
true
user=> (set/superset? 1 2)
Execution error (IllegalArgumentException) at user$eval3$fn__139$fn__140/invoke (REPL:1).
Don't know how to create ISeq from: java.lang.Long
user=> (require '[clojure.spec.test.alpha :as stest])
nil
user=> (require '[clojure.spec.alpha :as s])
nil
user=> (s/fdef set/superset? :args (s/cat :set1 set? :set2 set?) :ret set?)
clojure.set/superset?
user=> (stest/instrument)
[clojure.set/superset?]
user=> (set/superset? #{1 2 3 4} [1 2 3])
Execution error - invalid arguments to clojure.set/superset? at (REPL:1).
[1 2 3] - failed: set? at: [:set2]
user=>
Testing with set coercion is possible today by patching with alter-var-root. But I think I like the error messages better with spec.

borkdude08:11:20

And since clojure is compiled using direct linking, such a spec won’t impact clojure itself. I’m not sure if clojure.pprint is also directly linked…

andy.fingerhut08:11:48

Everything in Clojure is compiled with direct linking enabled, including clojure.data/diff has its calls to clojure.set functions direct linked. Doing instrument, which uses alter-var-root on, clojure.set functions, will not affect the behavior of clojure.data/diff.

andy.fingerhut08:11:00

FYI in case you are curious, spec'd functions have a fairly high performance penalty, even for simple specs. There are performance comparisons in this README: https://github.com/jafingerhut/funjible

andy.fingerhut08:11:20

If your goal to use spec vs. something else here is just running tests, then perhaps performance is not your main concern, though.

didibus08:11:55

That benchmark makes me wonder why is Spec so slow.

borkdude08:11:27

@andy.fingerhut yes. I ran some advent of code puzzles with instrumentation on clojure.core functions. it becomes creepingly slow

borkdude08:11:21

so I think this kind of instrumentation has its place during development and tests, but not in performance critical code

borkdude08:11:40

maybe spec-alpha2 does something about performance? I also wonder if spec-alpha2 works with older versions of Clojure, so you don’t have to maintain multiple versions of specs for different Clojure versions

andy.fingerhut09:11:52

So far the advice has always been that you probably don't want to run with specs enabled in production, because of performance reasons. You can of course go against that recommendation if you want, but the performance you are willing to live with in production is your decision to make.

didibus09:11:52

I'm just surprised that it would be much slower then an equivalent assertion.

kenran_09:11:19

I'm trying to switch from lein to deps.edn, and I hit a wall when packaging the app into an uberjar. I have net.mikera/imagez {:mvn/version "0.12.0"} as a dependency, and use pack.alpha, but I get an error: Could not find artifact net.mikera:mikera-pom:jar:0.6.0 in central ().

dominicm10:11:32

Hi, Pack author here. I don't recognize this particularly. Does the project work when you use it via clj? Is this only a problem when using pack?

kenran_10:11:22

Oh, sorry. I opened up issue 23 just as you must have been typing. I created a small example deps.edn you can test it with. It runs fine with clj -Arun, but packing throws the exception.

kenran_10:11:52

I found a workaround in issue 7 though, so it's not bad.

dominicm11:11:47

issue 7should no longer be relevant.

dominicm11:11:55

Can you try updating to the latest pack? Just to make sure?

dominicm11:11:38

Your pack version isn't the latest, definitely try d9023b24c3d589ba6ebc66c5a25c0826ed28ead5 Where did you find that sha? Did you copy it from somewhere?

kenran_12:11:17

Oh, yes, I copied it. Kind of embarrassed I didn't check that myself 😳

kenran_12:11:42

I'll test it soon. I just realized I copied this part of deps.edn from one tutorial thinking it was a recent one but it's already from feb.

kenran_12:11:51

I still get the error with d9023b24c3d589ba6ebc66c5a25c0826ed28ead5 though.

kenran_12:11:29

Adding the maven repos fixes it on that version as well. [This](https://github.com/mikera/core.matrix/issues/222) might be relevant.

kenran_12:11:51

Nevermind again. I tried it in the minimal example and not my actual project with the newest SHA 595388c5b909759445a92a19192df50e427aa9a5. It works there!

kenran_12:11:42

Still doesn't work in my project, but there seems to be an unrelated issue with dependencies. It doesn't seem to pull the newer pack version at all in that repo.

kenran_12:11:12

I'm very sorry for the hassle! Glad everything is working now and I can finally seem to get rid of leiningen 🙂

kenran_12:11:21

Thanks for the help and the great tool!

kenran_12:11:34

I'll close the issue soon.

dominicm13:11:23

If there's a issue still I'm happy to help you fix it! Feel free to ping me if you run into anything.

kenran_10:11:40

This error has some google results. someone blamed lein-npm which I don't have/use. Looking up this package on clojars, it tells me that the clojars package (0.0.4) might be shadowing a release on central. Any idea what I can do now? Can I somehow download this dependency locally so it can be found when packaging?

kenran_10:11:31

The net.mikera:mikera-pom in version 0.6.0 can be found in my ~/.m2 dir already though.

borkdude10:11:38

@didibus added this to the README of speculative as a result of our conversation yesterday: https://github.com/slipset/speculative#speculative-broke-my-project

didibus18:11:23

Awesome, I think that's a great addition.

borkdude12:11:15

@andy.fingerhut would adding type hints in this code help after you have done the pre-condition checks? https://github.com/jafingerhut/funjible/blob/master/src/funjible/set.clj Tim Baldridge did a benchmark with type hints that made the code even faster in some benchmarks, not slower. I’m not sure if his code is public (cc @tbaldridge)

borkdude12:11:32

maybe that should happen in Java code itself, I’m not sure

borkdude12:11:16

maybe wrapping the args in (set ...) (while still having the pre-conditions) will make the JIT faster because it knows it’s always a set

andy.fingerhut17:11:14

I don't know how type hints might help make that code run faster. Type hints most often make things faster if they help the compiler avoid reflection during Java interop calls, but there are none in that code.

borkdude17:11:35

@andy.fingerhut more information to the JIT

borkdude18:11:34

@andy.fingerhut I’m not sure how TB found the speedup, but it was something similar. He describes it in the defn podcast.

andy.fingerhut18:11:59

Are you saying you think they might help the spec'd version run faster? Or only the one with the type checks? The second seems possible, I just don't know exactly how. The first sounds harder to believe.

borkdude18:11:39

no, nothing to do with spec

borkdude18:11:55

I’ll look up the part where he talks about it, after dinner

Kari Marttila18:11:03

Is there any roadmap when the next Clojure version is coming out?

phill18:11:49

I would not want it to be rushed. Maybe Nov.29.

phill18:11:07

There is something of an air of "thinking out loud" in the latest betas.

orestis18:11:28

I’ve heard that podcast and he did say that it was a JIT thing, and it was the one that either called set or asserted the type. @andy.fingerhut @borkdude

andy.fingerhut18:11:23

If someone has a way that makes the type checking code even faster, I am all ears. I don't know how likely I am to find a chunk of several hours to devote to random experiments that don't pan out, but certainly open to other people wanting to do performance experiments on variations of that code 🙂

borkdude19:11:06

I have pinged Tim on Twitter to see if he still has this code and/or data

hlolli22:11:00

Is there any way, or any hack for that matter, to exclude a file included in a jar completly. It's a file that has no public member, but has unwanted side effects on require.

borkdude22:11:29

so who requires it?

hlolli22:11:54

a source file in my project, that retuires a source file (in a jar) that requires it, I don't require this file directly.

hlolli22:11:35

I could start by making phantom namespace with same name, and it would then ignore it right?

hlolli22:11:53

if I do it before this chain of requires..

hlolli22:11:22

found out that my problem was unrelated, there's something mysterious setting the jna.library.path to something else, after I assign to it... going to dig deeper.