Kenji
✅ Recursive type definition
I think I get what you mean. One issue I had reading your idea was about the valid case (one order of recursion, CRTP/CRGP), you said:
in this case, the nestedness is decreasing
This is not true, is it? It is not decreasing, but it is stable:
Consider instantiating B, which instantiates A with B<T>
, which is the type of the field. The field then instantiates an A, with a field of type B<T>
. Now if you expand this B<T>
you would instantiate an A again with a B<T>
, which is the type of the second-order field. You did not lose a level of nestedness, but you did not gain one either.
Maybe this is what the spec means by "instantiation closure is finite" versus "instantiation closure is infinite"34 replies
✅ Recursive type definition
But I also agree with your logic about the roslyn vs runtime point. Since it generates IL, the problem is on the runtime that tries to create a concrete type out of the generic.
Now the question is, should the runtime succeed in this, or is roslyn erroneously nodding along and letting me generate IL based on this C# snippet? 🤔
34 replies
✅ Recursive type definition
but mono is not working as intended according to the spec in some cases.
I think you are hitting my problem, but maybe 50% of it:
- The first part is, "should this fail?" ( as i understand your answer is "no")
- If yes, why does it fail? If no, you are most likely right, I should open a ticket (why runtime and not roslyn repo?)
34 replies