Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 14612 - typeid(interface) returns TypeInfo_Class object #4711

Closed
wants to merge 2 commits into from

Conversation

9rnsr
Copy link
Contributor

@9rnsr 9rnsr commented Jun 2, 2015

https://issues.dlang.org/show_bug.cgi?id=14612

Change the type of typeid(interface_obj) to TypeInfo_Interface, and fix TypeInfo object generation to support new TypeInfo hierarchy.

Requires corresponding druntime change: dlang/druntime#1295
Unfortunately, we need to fix compiler and druntime code at the same time.

@9rnsr
Copy link
Contributor Author

9rnsr commented Aug 29, 2015

Rebased on master, and ready for ddmd.

@yebblies
Copy link
Member

I really think typeid(i) must be the same as typeid(cast(Object)i). Having it do anything other than get the concrete type will make it harder to use interfaces and abstract base classes interchangeably.

I understand that the current way makes sense with how interfaces are implement in D, but I think that implementation is supposed to be hidden from the user. I think it's obscure and unintuitive to the point where most experienced D users would not guess the behavior correctly.

When I use typeid(class or interface reference) I'm always trying to find out the dynamic type of the class. I don't ever care about the interface's adjusted vtable or other implementation details.

@dlang-bot
Copy link
Contributor

Fix Bugzilla Description
14612 typeid(interface) returns TypeInfo_Class object

@9rnsr 9rnsr force-pushed the fix14612 branch 2 times, most recently from 9962193 to 138313b Compare April 15, 2016 04:00
@9rnsr
Copy link
Contributor Author

9rnsr commented Apr 15, 2016

I added more code to support incremental migration of dmd and druntime repositories.
Now this PR does not change anything. After the update of druntime, the new behavior will be introduced.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants