Assigning Interface to Object
Steven Schveighoffer
schveiguy at yahoo.com
Thu Jan 20 05:01:38 PST 2011
On Thu, 20 Jan 2011 02:01:26 -0500, Mandeep Singh Brar
<mandeep at brars.co.in> wrote:
> "This would be easily resolved if interfaces were known to be Objects. "
>
> But shouldnt this be the case, because there would be nothing called as
> an
> Interface which can be pointed to; it would be an Object which is
> implementing an
> interface which is being pointed to. So shouldnt Interfaces be Objects
> too.
> Otherwise, wouldnt it defeat the purpose of having Object as the base
> class for
> everything.
The issue is COM interfaces. What bugs me about it is, whether an
interface derives from IUnknown is known at compile time. I don't think
it's possible to define an interface that *doesn't* derive from IUnknown
that is not a D Object. I believe the compiler even handles IUnknown
interfaces differently.
I think the problem is that COM support was added when compile-time
functionality was in its infancy. There are quite a few legacy problems
due to that. For instance, the builtin array sort routine does not use
compile-time information.
It would be nice to fix this problem, but I'm not sure how willing Walter
is to do it. For sure, we need a solution to the opEquals problem.
-Steve
More information about the Digitalmars-d-learn
mailing list