Fork me on GitHub
#interop
<
2022-12-29
>
Joshua Suskalo18:12:59

Type hinting .. chains to avoid reflection warnings.

(deftype B [c])
(deftype A [^B b])

(.. ^A a -b -c)
What is the most idiomatic way to write code like this which uses type hints? I still get reflection warnings if I try a few things I'd think would help.

Joshua Suskalo18:12:35

It is type hinted, the issue is that -c is emitting the warning since it's coming from a typedef, and type hinting the typedef fields doesn't appear to fix the issue here.

Joshua Suskalo18:12:57

Should've been more clear in the original

Joshua Suskalo18:12:45

been doing too much C lately

Alex Miller (Clojure team)18:12:48

type hints in a deftype don't actually do anything in the record (other than ^long and ^double)

Joshua Suskalo18:12:16

right. I noticed that (.. ^A a ^B -b -c) also didn't suppress the warning though

Alex Miller (Clojure team)18:12:19

so in this case -b is of type Object and so that's not enough to help the compiler

Alex Miller (Clojure team)18:12:14

without thinking too hard about it, I would expect hinting -b to work, so not sure if I'm missing something or there's a bug

Alex Miller (Clojure team)18:12:27

does just using . work?

Alex Miller (Clojure team)18:12:22

well, throw it on https://ask.clojure.org if you want me to look at it more, I'm headed offline

Joshua Suskalo18:12:39

Sounds good, thanks for the help