C#'s greatest mistakes

Torarin torarind at gmail.com
Sat Nov 27 17:48:01 PST 2010


2010/11/28 Jonathan M Davis <jmdavisProg at gmx.com>:
> You could theoretically create a template which verified that a struct had the
> same functions that an interface required for a class to implement it, but since
> a struct can't implement it, it's just confusing and unnecessary to add a
> useless interface into the mix. The struct can't implement it.

I think it's a matter of taste whether it's confusing or not. I'd say
it looks better than the is(typeof({}())) combo, and in some ways it's
less confusing. Implement! may be a bad name, because structs will of
course not implement the interface in the traditional sense. The
interface is just the "concept".

Torarin


More information about the Digitalmars-d mailing list