Fork me on GitHub
#clr
<
2024-05-16
>
Arjen van Elteren08:05:12

Hi, I will report outside of the thread, I was able to get async to load at least with some manual "println" tracing. Basic problem comes down to this kind of construct (in the tools.analyzer code):

(def foo [recur? & [opts]] (when recur? (recur false [opts])))

Arjen van Elteren08:05:00

Running (foo true), will get the exception.

dmiller15:05:20

It appears likely you'll have to move to 1.12.0-alpha(latest). There was a bug report that explicitly mentioned two things appear in your report. (1) Your load error was occurring on a call to tools.analyzer.passes/schedule -- that function is explicitly mentioned in the bug report. (2) The specific code example given in the bug report that illustrates the problem is

(defn yikes [i & [opts]]
  (if (<= i 0)
    7
	(recur (dec i) [opts])))
Which looks very much like your function foo mentioned above. The bug report is here: https://clojure.atlassian.net/jira/software/c/projects/CLJCLR/issues/CLJCLR-113 It was a code-gen issue that doesn't seem to bother ClojureJVM but it did trip up ClojureCLR. (It is actually also a bug in ClojureJVM (@alexmiller, but the simple example we have does not cause the problem. You have to work really hard to manifest it in ClojureJVM:
PS C:\Users\dmill> clj
Clojure 1.11.1
user=> (defn yikes-again [i & [opts :as all]]
  (if (<= i 0)
    (clojure.lang.RT/seqToArray all)
        (recur (dec i) [opts])))
#'user/yikes-again
user=> (yikes-again -1) ;; does not recur, so it runs okay
#object["[Ljava.lang.Object;" 0x5c0f79f0 "[Ljava.lang.Object;@5c0f79f0"]
user=> (yikes-again 4) ;; recurs, the recurrence ends up sticking a PersistentVector in a local typed as an ISeq.
Execution error (ClassCastException) at user/yikes-again (REPL:2).
class clojure.lang.PersistentVector cannot be cast to class clojure.lang.ISeq (clojure.lang.PersistentVector and clojure.lang.ISeq are in unnamed module of loader 'app'
TL;DR: switch to 1.12.0-alpha -- The code is actually really stable.

Arjen van Elteren18:05:58

Thank you for the advice, I will do so! (currently running with custom analyzer code and everything I've tried with async works so far)

dmiller20:05:24

Cool. I'd say not too many people have played with the async (and as result with the analyzer, since the async is about the only thing that uses it), so if you run into anything else, let me know. I'll get on it right away.