Fork me on GitHub

I remember a while ago seeing a wiki page which had a list of the different categories of error messages, and comparisons of how they are handled in Clojure 1.10+ and in previous versions. I can’t find it now, can anyone help me out with a link?


and this links to a redirect page that has a bunch of links to subsections of that (but it seems the nav is broken)


Is it the intention that the data from Throwable->map be readable? Currently for a spec error they’re not, because the spec itself is printed as #object[...].


Spec 1 or Spec 2?


Clojure 1.10.1


Spec 2 isn’t out yet, right?


Spec 2 is available -- wasn't sure whether you were testing against that.


No, I’m just trying to fix error cases for whatever people are using right now.


How are you causing the Spec error? Just via a macro expansion?


Yes, that one is just a (let [x])

Alex Miller (Clojure team)02:01:35

Regarding the readability issue, that is a known issue, should really be the s/form


Thanks. I’ll transform the errors before I send them back, then. I guess when I receive them I’ll have to transform them back so that ex-triage works correctly?


Actually, that doesn’t seem necessary - just transforming on the sending side seems to work fine.


Can a type or record in clojure be extended to behave like a function and multimethod? This is easy w/ clojurescript but I'm stuck trying to get this to work in clojure. I'd appreciate any way to make this work since it breaks CLJC compatibility and with that the API of a library I'm planning to open source soon. CLJS example:

(defrecord MyMulti
  [add-method remove-method dispatch-fn method-table]
  (-add-method [_ dispatch-val f]
    (add-method dispatch-val f))
  (-remove-method [_ dispatch-val]
    (remove-method dispatch-val))
  (-methods [_] @method-table))


there's no equivalent to IMultiFn in clojure/jvm


@bronsa I'm aware. The question is can anything be done to make it work?


not using deftype or defrecord


@bronsa to provide some more detail: I'm looking to be able to use defmethod in cljc on my own type/record that exposes similar behavior.


I understand, it's not possible


Sorry about raising a topic again but I wonder why (get 1 1) ;;=> nil? 🙂 found that from the very beginning


this is widely known, and has been discussed to the point that it brings on a deep feeling of weariness to see it brough up again


but I suspect the discussions might be deep in the depths of the google group, searching of which is a pain, so you might want to throw it on to get an easier to find discussion


> searching of which is a pain @hiredman exactly, sorry for annoying raising it up again, I should have asked “where was the discussion”, this is really un-googlable unlike say but anyway “spec says so” (here: “nil if key not present”) doesn’t answer why 🙂 could you share the essense idea of that google group thread?


I don't recall, and I don't think it was once, I just think it has come up a number of times, and my (entirely unfair and overly general) summary is: rich likes it that way

rich 8

in some cases there’s a sort of “nice” flexibility in being able to do (get x "blah") on anything for x


but it can also be an easy source of just bad/buggy code


I think, and I don't recall the argument being put in these terms, the rational is something like "it is nice for get to be a total function"

👍 4
Alex Miller (Clojure team)23:01:01

There is a jira to throw on non-associative args to get, which has been debated off and on

Alex Miller (Clojure team)23:01:23

If I had to guess, I’d say Rich probably thinks it’s undefined

Alex Miller (Clojure team)23:01:20

Is someone out there relying on this such that they would be broken if it changed? No idea

🔥 4

Given how prevalent get probably is in Clojure code, it seems fairly likely someone is relying upon it. There has been 12 years and tens of thousands of developers for Hyrum's law to be enacted there.


Hyrum's law always gets you 😄


I was browsing through page for get to see if it mentioned any motivating reasons, but no. I did find this behavior that I probably actually documented, but had forgotten, which only happens for vectors, arrays, and strings, I believe (occurs because of truncating behavior of a call to intValue in the implementation):

user=> (get ["a" "b" "c"] 4294967296)

🤯 32

From where 4294967296 came from?


max unsigned integer + 1


(get ["a"] (* 2 (inc Integer/MAX_VALUE)))
(.intValue  (* 2 (inc Integer/MAX_VALUE))) ;;=> 0

Alex Miller (Clojure team)16:01:42

didn't 1.5 used to work too? I think we fixed that at some point


clojure/lang/ Line 698 In 1.10.1 jar