What's wrong with D's templates?

Nick Sabalausky a at a.a
Sun Dec 20 09:36:13 PST 2009


"Lutger" <lutger.blijdestijn at gmail.com> wrote in message 
news:hgl440$tlo$1 at digitalmars.com...
> Yigal Chripun wrote:
>>
>> The .Net implementation isn't perfect of course and has a few issues
>> that should be resolved, one of these is the problem with using
>> operators. requiring interfaces by itself isn't the problem though. The
>> only drawback in this case is verbosity which isn't really a big deal
>> for this.
>
> The drawback is not verbosity but lack of structural typing. Suppose some
> library has code that can be parametrized by IFoo and I have another 
> library
> with a type that implements IBar, which satisfies IFoo but not explicitly
> so. Then what? Unless I have totally misunderstood .NET generics, I have 
> to
> create some proxy object for IBar that implements IFoo just to satisfy the
> strong type checking of .NET generics. You could make the argument that 
> this
> 'inconvenience' is a good thing, but I do think it is a bit more of a
> drawback than just increased verbosity.

It sounds like you're talking about duck typing? 





More information about the Digitalmars-d mailing list