Fork me on GitHub
#clojure
<
2018-09-29
>
leonoel11:09:39

(aset (object-array 1) 0 0)
emits a reflection warning. What is the correct way to hint this ?

Eccentric J12:09:28

@leonoel does (def my-array (into-array Integer/TYPE [1 2 3])) work? It’s the example from http://clojuredocs.org/clojure.core/aset

Eccentric J12:09:26

(int-array) might get you there too

leonoel12:09:04

no, I need to store values of arbitrary types so the array can't be primitive and values must be boxed

Jan K12:09:56

not sure if this is a good idea, but no reflection warning: (aset (object-array 1) 0 (Long. 0))

leonoel12:09:04

not sure either

leonoel12:09:35

for now my workaround is (aset (object-array 1) 0 (identity 0)) and this feels utterly clumsy

bbrinck18:09:55

Is there a way to get more detailed error messages when parsing EDN? In my limited tests, edn/read-string doesn’t say much about what was expected

lilactown22:09:31

what would ya'll use for service-to-service auth?

lilactown22:09:54

buddy / friend seem pretty focused on user auth

andy.fingerhut22:09:06

@bbrinck I have not compared the error messages for invalid edn data between the edn reader built into Clojure vs. the one in the library tools.reader, but if it matters to you I would try some experiments to see.

andy.fingerhut22:09:47

I think both of those readers can take a Java LineNumberingPushbackReader and you can then get some line and column number info, either attached to the parsed data, or maybe also in the error messages.

bbrinck17:09:22

Thanks for the idea on using LNPR - I used it to print better errors for EDN parsing errors in check-deps. Thanks!

bbrinck22:09:28

@andy.fingerhut good ideas. Thanks!