On Monday, 3 December 2012 at 20:59:24 UTC, Walter Bright wrote:
On 12/4/2012 2:52 AM, Jacob Carlborg wrote:
Note, I'm not saying that an interface should be implicitly converted to
any class, only to Object.


But not all interfaces come from Objects.

IMO this is a design mistake - the special case is preferred over the common case which goes against the D philosophy of making the common case easy and the special case possible.

All COM instances are known at _compile_time_ as they're all required to inherit from a special IUnknown interface so the compiler _knows_ if indeed an interface represents a COM instance or not. This can be used to handle this special case differently.

Interface i = new Class();
Object o = i; // should work for regular interfaces

The compiler can issue a compile-time error if i is COM since this is known at compile type.

Reply via email to