Kenji
✅ Recursive type definition
This is valid (basically CRTP):
This is not, because if you instantiate anywhere a
new Derived<SomeType>()
, the program panics with TypeLoaderException
because of "recursive generic definition"
I cannot understand the different between these two generic definitions.
If I specify SomeType
, I would imagine that the generics should expand as expected and resolve the types correctly, as kind-0 types, e.g.: Derived<int> : Base<Derived<Derived<int>>>
The only thing I could find is the official explanation on the CLI Standard here on page 129 https://www.ecma-international.org/publications-and-standards/standards/ecma-335/, but I do not quite get it. 🙂
Any ideas?34 replies