<p>Am 01.09.2017 14:50 schrieb "Stefan Glienke" <<a href="mailto:sglienke@dsharp.org">sglienke@dsharp.org</a>>:<br>
><br>
> > For generics the only way to support them is that you must explicitly specialize a generic helper type. The compiler won't do any type inference for you.<br>
><br>
> IMO this makes them rather useless. Is that a technical limitation or just something you did not want to do?<br>
> I don't know much about compiler internals for forgive me my naivety.<br>
><br>
> If I have TFoo<T> and a TFooHelper<T> and somewhere declare a TFoo<Integer> and use a method<br>
> from my helper can't the compiler make sure to compile the TFooHelper<Integer> version for it?</p>
<p>What if I do the initial specialization in a unit that does not know about the helper? It can't just do speculative specialization once both the specialized generic and the generic helper are used in the same unit. And even if the compiler would postpone it till some method of the specialized type is called things would get polluted once multiple helpers lee type are allowed as every one of the generic helpers in scope would need to be specialized for overload resolution.</p>
<p>So in short: no, I don't *want* this, but it's due to technical reasons.</p>
<p>> I guess it's because it does not know anymore that TFoo<Integer> is in fact a closed generic type that was constructed from the open geneneric type TFoo<T>?</p>
<p>The compiler can know rather easily that a type is a specialization, but you need to keep in mind that helpers are also active for parent types. So if you descend from a specialization the helpers of the generic would need to be available as well.</p>
<p>Regards,<br>
Sven</p>