Kenji
Kenji
CC#
Created by Kenji on 5/31/2023 in #help
✅ Recursive type definition
yeah, that makes sense. 🙂 I think I will open an issue in the roslyn repo then, since this should not even compile, to prevent issues as early as possible
34 replies
CC#
Created by Kenji on 5/31/2023 in #help
✅ 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:
class A<T> { T t; }
class B<T> : A<B<T>> { }
class A<T> { T t; }
class B<T> : A<B<T>> { }
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
CC#
Created by Kenji on 5/31/2023 in #help
✅ Recursive type definition
thanks for the brainstorming
34 replies
CC#
Created by Kenji on 5/31/2023 in #help
✅ Recursive type definition
sure
34 replies
CC#
Created by Kenji on 5/31/2023 in #help
✅ 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
CC#
Created by Kenji on 5/31/2023 in #help
✅ Recursive type definition
If you want to try to succeed where I failed and understand it, check the ECMA link in my original post (page 155 on the pdf, 129 on the actual bottom-right corner)
34 replies
CC#
Created by Kenji on 5/31/2023 in #help
✅ Recursive type definition
It's possible that the definition here of "infinite instantiation closure" is wrong. The problem with this assumption, is that I am an idiot and I don't understand the "proof" 😅 (which was one of my questions)
34 replies
CC#
Created by Kenji on 5/31/2023 in #help
✅ Recursive type definition
CLI (common language infra), not CIL**
34 replies
CC#
Created by Kenji on 5/31/2023 in #help
✅ Recursive type definition
34 replies
CC#
Created by Kenji on 5/31/2023 in #help
✅ Recursive type definition
that's a very astute point.
34 replies
CC#
Created by Kenji on 5/31/2023 in #help
✅ 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