TSelf generic confusion [Answered]
So I'm trying to implement an
IFunctor
interface (so I know I'm kind of doomed from the start), but this is what I have currently:
It's ugly as hell, I know. I'm getting an error on new Maybe<U>()
saying it can't implicitly convert from Maybe<U>
to IFunctor<USelf, U>
, except Maybe<U>
should implement IFunctor<USelf, U>
, right?4 Replies
Tried changing the return type of the interface method to just
USelf
but that still causes the same error.
oh USelf
has no inherent connection to TSelf
ughhh
dammit generics give us TSelf<U>
alreadyWhat is the intent? Like of the TSelf vs T
Yes, and that doesn't work
I.e. it needs something like
TSelf<U>
Which is why I said "so I know I'm kind of doomed from the start"
Just had to rubber-duck myself to realize this isn't possible✅ This post has been marked as answered!