I've been trying to figure out why ClojureCLR has a failing test, coming from clojure.test-clojure.compilation. The test is the equivalent of
(list? (:arglists (meta #'when)))
[premature posting -- continuing]
This is a test coming from ClojureJVM, so not my problem (re list? vs some other test).
this returns true, and indeed the value is a PersistentList .
However,
user=> (defn f [x] x)
#'user/f
user=> (class (:arglists (meta #'f)))
clojure.lang.PersistentVector$ChunkedSeq
and list? defintely fails on that.
The :arglists value is computed by clojure.core/sigs and as I look at that, it is going to create PV$ChunkedSeq no matter what. So how does when and in fact everything I've tested in clojure.core have a PersistentList. Can it be that this is getting scrubbed by passing through AOT-compilation? In other words, the initialization code in the class file creates a PersistentList ? Because that's what I'm seeing in ClojureCLR on Framework 4.x, where we still have AOT-compilation. When I run on .Net Core and 6.0 and 7.0, there is no AOT, so when 's arglist is not a list.
Help!Almost certainly it is aot compilation, the chunked seq won't be special cased in the compiler, so it will be serialized using pr-str to embed in the generated class file, and then the static init of the generated class file will use read-string to deserialize where it will come out as a list
The reason it is only sot compilation and not the regular compilation is in regular compilation the var metadata doesn't need to get serialized into bytecode
On ClojureCLR, it comes out in the init method in the assembly as a call to PersistentList.create.
yeah, I was incorrect, about the pr-str/read-string, the compiler does handle seqs specially, but the way it does, they all get turned into PersistentList
@dmiller FWIW, I stopped using list? for this exact reason and use seq? pretty much everywhere instead of it
Without spending some time on it, can’t definitively answer why, but i do think seq? is a better test here
Believe me, I spent way too much time on this. I don't wish that on anyone else. Shall I post an issue on it, or do you want to?
An issue to do what?
The test is ClojureJVM code. I just inherited it. I'll change it on ClojureCLR, no problem. Never mind.
Yeah, I don’t think this is high priority to do anything about
Understood. As I said, never mind. (I can't ignore it over here, so I'll make the change.)