Fork me on GitHub
Linus Ericsson09:06:59

We get the following error when doing some xml-stuff (having [com.fasterxml.jackson.core/jackson-core "2.12.3"] [org.clojure/data.xml "0.2.0-alpha6"] [clj-xml-validation "1.0.2"] as xml-related libs, WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by clojure.lang.InjectedInvoker/0x00000008401e8040 (file:/home/X/Y/Z/local-m2/org/clojure/clojure/1.11.0-alpha1/clojure-1.11.0-alpha1.jar) to method WARNING: Please consider reporting this to the maintainers of clojure.lang.InjectedInvoker/0x00000008401e8040 WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations WARNING: All illegal access operations will be denied in a future release What can it be, what can we do about it?


I am not sure, but I would guess Java version


Try Java 8 or use different versions of libraries

Linus Ericsson10:06:27

We will keep the JDK version because of alpn-features etc. So far this is a warning, but it would be nice to get it sorted ofc

Alex Miller (Clojure team)12:06:34

Note that this reports as Clojure because it’s a code generated by Clojure but that’s probably not the actual source. Use the debug setting talked about there to pinpoint the actual source

Alex Miller (Clojure team)12:06:10

It’s wherever newSchema is being called - adding a type hint to the interface is probably sufficient there


What is the access and assoc time complexity of a Clojure vector?


It's O log32 n. Its a shallow tree with 32 element wide nodes. So maximum deepness would be 7. Assoc means creating up to 7 arrays of 32 elements, on huge vectors.


Can somebody point me to the Clojure source loc’s where vectors are implemented?


@U01F1TM2FD5 Its pretty complex code. (APersistentVector is a abstract) If your goal is to understanding the algorithm I think I made a simpler to understand implementation in F#, lacking some features like e.g. transients. It doesn't use boxing and is hence homogeneously typed. Rich has made excellent videos on how it works.


I am looking at clj-http and I am trying to understand the retry logic; is there anything included about backoffs, retries on specific status codes?


:retry-handler is what you're after - it doesn't do much but you can plug in your own retry logic there


Yeah I noticed about it. I’m just lazy to write all that kind of logic that is built in the Python library trollface


There might be some repos/gists laying - worth searching, you can turn the problem inside out and use libs like (or something simpler)


Oh that looks interesting, thank you

Miguel Rivas18:06:43

Hi there, how can we get the namespace of a function? Is there any way to achieve this from this context using alter-var-root?

(defn my-wrapping-fn
  (alter-var-root function
                  (fn [f]
                    (fn [& n]
                      (let [f-namespace ??? ;; want to get f's namesapce here
                            result (apply f n)]


namespaces are a property of a function


a function is a value, like the number 5


when you (def x 5) 5 doesn't know about about x and doesn't know about the namespace x is in


@mrivas616 Usually only vars carry the namespace metadata, so you'd have to retain a reference to the var, not the function it holds


But if you have that, then it's (:ns (meta the-var))



user=> (:ns (meta #'inc))
#object[clojure.lang.Namespace 0x75f2099 "clojure.core"]


you can call ns-name on that to get clojure.core as a symbol

Miguel Rivas18:06:37

Gotcha, thanks 😄 :thumbsup:


there is a hack to retrieve the ns symbol from the munged function name, but it's a bit of a low level / possibly unsupported hack. it's used in clojure.spec.alpha

😮 2
👀 2
Miguel Rivas19:06:17

Is there any reason/advantage on using (clojure.lang.Compiler/demunge) instead of (clojure.main/demunge)? :thinking_face: taking a look at the code in clojure.spec.alpha


That might possibly be an optimization. That's only a guess. Got a link to the code?

Miguel Rivas19:06:34

Yeah, I was thinking the same :thinking_face: here is the code for context:

Alex Miller (Clojure team)02:06:50

I don't actually remember, but probably just avoiding the clojure.main require

Alex Miller (Clojure team)02:06:58

this is no longer needed in spec 2

Alex Miller (Clojure team)02:06:45

(because things stay symbolic without being eval'ed to a function object)

❤️ 3

you can call .ns on the var as well as getting it from the metadata

👋 2

not really portable across implementations though but maybe that's not a concern

👍 2