typeid() broken for interfaces?

deadalnix deadalnix at gmail.com
Mon Dec 3 13:07:23 PST 2012


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.

So I thought about all that.

typeid is about runtime type detection. As all interfaces are not 
coming from object, it is definitively an issue to resolve them 
as object sometime. However, keeping tied to the static type when 
runtime typeid is asked for is a but sad.

But interfaces that don't resolve as object are well know at 
compile time. So isn't it possible to resolve all interfaces that 
we know are objects into object's typeid ? After all, this is 
what typeid is about.


More information about the Digitalmars-d mailing list