This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-05-01
Channels
- # announcements (14)
- # aws (1)
- # babashka (22)
- # beginners (105)
- # biff (12)
- # calva (1)
- # cider (7)
- # cljsrn (1)
- # clojure (33)
- # clojure-europe (22)
- # clojure-germany (1)
- # clojure-uk (3)
- # clojurescript (28)
- # component (15)
- # copenhagen-clojurians (1)
- # core-typed (29)
- # cursive (8)
- # data-science (2)
- # datomic (2)
- # emacs (16)
- # gratitude (3)
- # humbleui (3)
- # introduce-yourself (4)
- # lsp (1)
- # other-languages (3)
- # rdf (3)
- # sci (6)
- # shadow-cljs (9)
- # spacemacs (12)
- # tools-build (1)
- # tools-deps (5)
- # vim (3)
- # vscode (1)
Do make-array and into-array support specifying types? I see https://github.com/babashka/babashka/issues/1144 was closed, but it’s not working as expected if I specify a type:
(make-array ArrayDeque 5)
: Class java.util.ArrayDeque[] is instantiated reflectively but was never registered. Register the class by using org.graalvm.nativeimage.hosted.RuntimeReflection edit-distance
(->> (repeatedly 5 #(ArrayDeque.))
(into-array ArrayDeque))
: Class java.util.ArrayDeque[] is instantiated reflectively but was never registered. Register the class by using org.graalvm.nativeimage.hosted.RuntimeReflection edit-distance
@kingmob Do you think it makes sense to fall back on the Object
array in case of this error? I didn't know the consequences of that decision
Sorry, it’s been ages since I thought about casts in Clojure, it’s 230am here, and my brain is fried from implementing the Hunt-Szymanski LCS algorithm so…lemme think about it 😄
@U04V15CAJ don't think that makes sense since arrays are covariant.
user=> (cast (class (make-array String 0)) (make-array Object 0))
Execution error (ClassCastException) at java.lang.Class/cast (Class.java:3889).
Cannot cast [Ljava.lang.Object; to [Ljava.lang.String;
I know, but in practice, I haven't seen any code in Clojure which actually cares about the specific type in an object array?
I know that Java cares, but within Clojure code objects are usually passed around as Objects
yeah, but why else would you bother creating a non-Object array if not to pass to a Java method that needs it?
FWIW I don't remember ever seeing code that cared about the array type that didn't specify it explicitly. Defaulting to Object[] for 1 args into-array
makes sense to me. I also agree with https://github.com/babashka/babashka/issues/1144#issuecomment-1013853068
@U055XFK8V just to be sure, do you think anything should be changed, or not?
@U04V15CAJ tough call! on the fence.
aw yeah! a source-compatible aws-api for babashka https://twitter.com/grzm/status/1520863547076587520