Currently a generic class such as
class A<B extends C<D>, D>
Must have both B and D passed when instantiated, but it would be nice if the type system could infer the type D from type B. Because if I pass in type B which extends type C
Or am I approaching this the wrong way? I'm just trying to avoid us having to unnecessarily import interfaces all over the place!
Say that I define a generic class as such
class A<B<C>>
Is it therefore possible in any form or fashion to be able to extract type C from generic type B? Or is this impossible?
It would be incredibly, immensely useful to be able to extract the type of a generic type, especially when type mapping (another issue that I have opened).
In the nightly build there is some nice new syntactic sugar around default type arguments that allows you to omit type them from consumption sites in a number of places as well as pass down defaults which can, optionally, be themselves derived from other type arguments.
That said, I think you are after higher-kinded types, or perhaps existential types.
Most helpful comment
In the nightly build there is some nice new syntactic sugar around default type arguments that allows you to omit type them from consumption sites in a number of places as well as pass down defaults which can, optionally, be themselves derived from other type arguments.
That said, I think you are after higher-kinded types, or perhaps existential types.