Marc Knaup
12/29/2019, 9:12 AMin
and out
properly 😅
Passing a Something<out Result, in Data>
to a function of SomethingElse<out Result, in Data>
is impossible without casting and I’m pretty sure it’s wrong anyway. But I have no idea how to model something like that properly…
In my case I have a Visitor<out Result, in Data>
and want to pass it a VisitCoordinator<out Result, in Data>
. Noooo legit way.Zach Klippenstein (he/him) [MOD]
12/29/2019, 4:05 PMMarc Knaup
12/29/2019, 4:46 PMVisitCoordinator
to Visitor
. I’ll follow up with the code once I’ve finished and pushed it 🙂Marc Knaup
12/30/2019, 1:20 PMZach Klippenstein (he/him) [MOD]
01/07/2020, 2:43 AMdata
parameter to __unsafeVisitChildren
with @UnsafeVariance
to make the code compile, but you might get cast exceptions at runtime if a Visitor.onNode
implementation passes an invalid type.Marc Knaup
01/09/2020, 1:34 PM@UnsafeVariance
😄
So, I assume there’s no safe way to achieve that.Zach Klippenstein (he/him) [MOD]
01/09/2020, 7:08 PM