This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-11-17
Channels
- # beginners (69)
- # calva (25)
- # cider (12)
- # cljdoc (17)
- # cljs-dev (60)
- # clojure (67)
- # clojure-spec (2)
- # clojure-uk (17)
- # clojurescript (46)
- # cloverage (1)
- # code-reviews (6)
- # cursive (3)
- # datascript (8)
- # figwheel-main (1)
- # fulcro (13)
- # hyperfiddle (25)
- # off-topic (7)
- # re-frame (24)
- # reagent (12)
- # reitit (24)
- # ring (8)
- # spacemacs (11)
- # specter (22)
- # tools-deps (7)
- # unrepl (1)
Sean Corfield: Clojure alpha tester by day, Clojure beta tester by night. 🙂
Still day here 🙂
And you know how much I just love to get new Clojure builds into production quickly!
I know you do it, for sure. I hope you love it, because otherwise you may be a bit touched in the head 🙂
From someone who resembles that remark.
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!
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.
I still feel very burned by Scala (from the 2.7 -> 2.8 -> 2.9 fiasco).
World Singles: Deploying Clojure features before release since 2011.
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.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…
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.
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
If your goal to use spec vs. something else here is just running tests, then perhaps performance is not your main concern, though.
@andy.fingerhut yes. I ran some advent of code puzzles with instrumentation on clojure.core functions. it becomes creepingly slow
so I think this kind of instrumentation has its place during development and tests, but not in performance critical code
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
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.
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 (
.
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?
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.
Your pack version isn't the latest, definitely try d9023b24c3d589ba6ebc66c5a25c0826ed28ead5
Where did you find that sha? Did you copy it from somewhere?
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.
Adding the maven repos fixes it on that version as well. [This](https://github.com/mikera/core.matrix/issues/222) might be relevant.
Nevermind again. I tried it in the minimal example and not my actual project with the newest SHA 595388c5b909759445a92a19192df50e427aa9a5
. It works there!
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.
I'm very sorry for the hassle! Glad everything is working now and I can finally seem to get rid of leiningen 🙂
If there's a issue still I'm happy to help you fix it! Feel free to ping me if you run into anything.
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?
The net.mikera:mikera-pom
in version 0.6.0 can be found in my ~/.m2
dir already though.
@didibus added this to the README of speculative as a result of our conversation yesterday: https://github.com/slipset/speculative#speculative-broke-my-project
@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)
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
anyway, linked your data here: https://dev.clojure.org/jira/browse/CLJ-2433?focusedCommentId=50544&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-50544
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.
@andy.fingerhut more information to the JIT
@andy.fingerhut I’m not sure how TB found the speedup, but it was something similar. He describes it in the defn podcast.
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.
Is there any roadmap when the next Clojure version is coming out?
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
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 🙂
@andy.fingerhut found the section. it’s here at 43:19-44:00 https://soundcloud.com/defn-771544745/41-timothy-baldridge-aka-halgari
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.
a source file in my project, that retuires a source file (in a jar) that requires it, I don't require this file directly.