Bug 14438 – is(A P == super) (tuple of supertypes) should work with structs and alias this

Status
NEW
Severity
enhancement
Priority
P4
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-04-10T16:52:10Z
Last change time
2024-12-13T18:42:07Z
Assigned to
No Owner
Creator
Andrei Alexandrescu
Moved to GitHub: dmd#18973 →

Comments

Comment #0 by andrei — 2015-04-10T16:52:10Z
Currently D offers a means to get all supertypes (base class and implemented interfaces) of a class types with this construct: static if (is(C P == super)) { } Inside the static if, P is a tuple starting with the base class and continuing with all implemented interfaces, in lexical order. Now consider: struct S(T) { private T datum; T fun() { return datum; } alias fun this; } There is no introspection mechanism that, given S, finds T. There should be one, and it should work with the upcoming multiple alias this. I think it's fine if we use the same syntax.
Comment #1 by robert.schadek — 2024-12-13T18:42:07Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/18973 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB