This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-06-11
Channels
- # announcements (38)
- # babashka (5)
- # beginners (26)
- # calva (26)
- # cider (1)
- # clj-kondo (36)
- # cljdoc (17)
- # cljs-dev (31)
- # clojure (39)
- # clojure-australia (9)
- # clojure-berlin (2)
- # clojure-dev (31)
- # clojure-europe (22)
- # clojure-france (3)
- # clojure-italy (7)
- # clojure-nl (5)
- # clojure-norway (5)
- # clojure-spec (28)
- # clojure-uk (9)
- # clojured (20)
- # clojurescript (24)
- # community-development (2)
- # conjure (32)
- # core-async (7)
- # cryogen (6)
- # datomic (2)
- # duct (6)
- # fulcro (6)
- # graalvm (53)
- # introduce-yourself (2)
- # jobs (2)
- # luminus (2)
- # nrepl (2)
- # off-topic (35)
- # re-frame (17)
- # reveal (8)
- # shadow-cljs (27)
- # testing (2)
- # xtdb (8)
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 http://com.sun.org.apache.xerces.internal.jaxp.validation.XMLSchemaFactory.newSchema(http://com.sun.org.apache.xerces.internal.xni.grammars.XMLGrammarPool) 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?
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
https://clojure.org/guides/faq#illegal_access gives some background on the issue
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
It’s wherever newSchema is being called - adding a type hint to the interface is probably sufficient there
Probably here https://github.com/rkday/clj-xml-validation/blob/69bbe6d7d0f2ec7348fa6ccc801b427ee4849875/src/uk/me/rkd/xml_validation.clj#L14
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?
https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/APersistentVector.java
@U01F1TM2FD5 Its pretty complex code. https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/PersistentVector.java (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. https://github.com/stefanvstein/fsgrit/blob/master/Vector/Vector.fs. 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
There might be some repos/gists laying - worth searching, you can turn the problem inside out and use libs like https://github.com/joelittlejohn/clj-http-hystrix (or something simpler)
https://github.com/joegallo/robert-bruce or https://github.com/BrunoBonacci/safely are also available as generic retry libs
Something on the same line of https://findwork.dev/blog/advanced-usage-python-requests-timeouts-retries-hooks/#retry-on-failure — which is very very well done
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
[function]
(alter-var-root function
(fn [f]
(fn [& n]
(let [f-namespace ??? ;; want to get f's namesapce here
result (apply f n)]
result)))))
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
e.g.:
user=> (:ns (meta #'inc))
#object[clojure.lang.Namespace 0x75f2099 "clojure.core"]
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
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?
Yeah, I was thinking the same :thinking_face: here is the code for context: https://github.com/clojure/spec.alpha/blob/master/src/main/clojure/clojure/spec/alpha.clj#L135
I don't actually remember, but probably just avoiding the clojure.main require
this is no longer needed in spec 2
(because things stay symbolic without being eval'ed to a function object)