I have a small question: why aren't interfaces implicitly convertible to
Object?
--
Bye,
Gor Gyolchanyan.

I don't know if there's any particular reason, but for what it's worth:
Casting an interface to Object means going through its vtable back to
the original object location. In other words, it's not "free" (though
the cost is extremely minimal).
--
Alex Rønne Petersen
alex lycus.org
http://lycus.org

I have a small question: why aren't interfaces implicitly convertible=

to

Object?

Not all interfaces =C2=BBoriginate=C2=AB from D objects, they can also=

be COM =

interfaces. Using (cast(Object)foo) should work if foo is really an =

Object.

All Com interfaces inherit from IUnknown. This is statically known.
The idea that we cannot tell which interfaces are COM and which are norm=
al
is a myth.
There is no reason why interfaces (that aren't COM) shouldn't be
implicitly castable to Object.
-Steve

I have a small question: why aren't interfaces implicitly
convertible to
Object?

Not all interfaces »originate« from D objects, they can also
be COM interfaces. Using (cast(Object)foo) should work if foo
is really an Object.

All Com interfaces inherit from IUnknown. This is statically
known.
The idea that we cannot tell which interfaces are COM and which
are normal
is a myth.
There is no reason why interfaces (that aren't COM) shouldn't be
implicitly castable to Object.
-Steve

Technically true, however COM is not the only example of foreign
objects used via interfaces. The (limited) C++ compatibility,
for example, works this way.

All Com interfaces inherit from IUnknown. This is statically known.
The idea that we cannot tell which interfaces are COM and which are =

normal
is a myth.
There is no reason why interfaces (that aren't COM) shouldn't be
implicitly castable to Object.
-Steve

Technically true, however COM is not the only example of foreign objec=

ts =

used via interfaces. The (limited) C++ compatibility, for example, =

works this way.

Those are extern(C++), also statically known.
In fact, the very nature of how interfaces work makes it very difficult =
=
for us to *not* statically know that an interface is a D interface -- D'=
s =
implementation of interfaces is not like any others.
-Steve