interface reference not compatible to Object?

Max Samuha maxter at i.com.ua
Mon Oct 23 00:36:12 PDT 2006


On Sat, 21 Oct 2006 21:54:03 +0200, Frits van Bommel
<fvbommel at REMwOVExCAPSs.nl> wrote:

>Max Samuha wrote:
>> On Sat, 21 Oct 2006 15:11:59 +0200, Frits van Bommel
>> <fvbommel at REMwOVExCAPSs.nl> wrote:
>> 
>>> Frank Benoit (keinfarbton) wrote:
>>>> Wouldn't it be consistent if the compiler implicitly inherit all
>>>> interfaces without a super-interface from this IObject?
>>> Maybe Object itself as well?
>>> That way functions can accept any object (whether referenced by class or 
>>> interface) as an IObject.
>>>
>>> Though I would prefer it if all interface references would just be 
>>> implicitly convertible to Object. Java does this, IIRC.
>> 
>> The problem is that not all objects in D are D objects. An interface
>> may be a com interface that cannot be cast to Object or inherit from
>> IObject. It was discussed somewhere in the NG, IIRC
>
>Can non-COM interfaces be implemented by COM objects? (I'm pretty sure 
>they at least can't be implemented by non-d objects, so does it matter?)
>
Don't really know. Never tried that.

>Since whether an interface is a COM interface can easily determined 
>(they inherit from std.c.windows.com.IUnknown) can't we at least make it 
>so that all non-COM interfaces are convertible to Object?

One more special case rule in the language. Though I wouldn't mind if
it was there.





More information about the Digitalmars-d mailing list