I guess it's expected that the non-inlined version of alength
uses reflection, right?
well you don't care if it's inlined :)
maybe the inlined one does as well btw. it's the same.
user=> (. clojure.lang.RT (alength (into-array [1 2 3])))
Reflection warning, NO_SOURCE_PATH:1:1 - call to static method alength on clojure.lang.RT can't be resolved (argument types: unknown).
3
just wanted to check if this is expected(ran into an issue with graalvm with this)
$ bb -e "(count (into-array [1 2 3]))"
3
$ bb -e "(alength (into-array [1 2 3]))"
----- Error --------------------------------------------------------------------
Type: java.lang.ClassNotFoundException
Message: clojure.lang.RT
^ the last error is because of the reflection at runtime, I think, because it's not statically clear which alength method it's going to callSort of amusing, because the jvm alength instruction doesn't care about the array type, so doesn't require reflection, but you can't write a java method that takes any array type (prims or objects), so RT has a bunch of static methods, alength could call any which introduces reflection
I don’t think so w how inlining works
Given the amount of time I’ve spent optimizing array code in bytecode with Clojure, I’m pretty sure I would have noticed that
Perhaps if it’s inlined, in a lot of cases local inference will take care of it?