TypeInfo_Class.interfaces[n].classinfo has TypeInfo_Class and not TypeInfo_Interface?

Tofu Ninja joeyemmons at yahoo.com
Wed Dec 27 23:28:27 UTC 2017


On Sunday, 24 December 2017 at 05:21:44 UTC, Tofu Ninja wrote:
> I didn't get any response in learn for this so I will ask it 
> here.
>
> TypeInfo_Class.interfaces[n].classinfo has TypeInfo_Class and 
> not TypeInfo_Interface?
>
> Is this correct? Or is it a bug?
> Doesn't make much sense to me.
>
> Also the following code prints false so there are some 
> consequences to this.
> # # ]]]]]]]]]]]]
> import std.stdio;
> void main(string[] args) {
> 	writeln(typeid(c).interfaces[0].classinfo == typeid(i)); // 
> false
> }
> interface i {}
> class c : i {}
>
> What is the proper way to handle this mismatch?
> Is this mismatch intended or just some implementation detail?
> Peoples thoughts on this?

I guess I will just not get an answer to this, seems like just 
some weirdness of D that will just stick there. The typeinfo 
system seems really half baked and really provides very little in 
terms of usefulness.


More information about the Digitalmars-d mailing list