Running on jvm, Kotlin presumably handles everything with GC allocated classes and single inheritance. C# can disambiguate such design, this compiles:
class A<T> { }
class B<T> : A<T> { }
class C<T> : B<T> { }
void test1<T>(A<T> a, int b) { }
void test1<T>(B<T> a, int b) { }
void test2(A<int> a, B<int> b, C<int> c)
{
test1(a, 0);
test1(b, 0);
test1(c, 0);
}
But wrappers in C# use multiple inheritance. For some reason Memory
doesn't implicitly convert to Span
, but it's not in D tradition and it doesn't look like something prevents it, then type hierarchy would look like this:
class Memory<T> : ReadOnlyMemory<T>, Span<T>
class ReadOnlyMemory<T> : ReadOnlySpan<T>
class Span<T> : ReadOnlySpan<T>
i.e. the diamond pattern with multiple inheritance, I think this will be challenging to disambiguate, and it happens merely due to proliferation of wrapper types.