Bug 23558 – add __traits(getModuleClasses [, module name])

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P4
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2022-12-15T06:44:07Z
Last change time
2023-02-22T09:14:42Z
Keywords
pull
Assigned to
No Owner
Creator
Walter Bright

Comments

Comment #0 by bugzilla — 2022-12-15T06:44:07Z
Since Object.factory() is being deprecated https://github.com/dlang/dmd/pull/14681 a convenient replacement is necessary. TraitsExpression: __traits ( getModuleClasses [, TraitsArgument] ) The TraitsArgument is the name of the module or a fully qualified import. If the TraitsArgument is not specified, it defaults to the current module. It returns a Tuple of strings representing the fully qualified classes defined in the specified module. For example: module test; import std.stdio; class C { } pragma(msg, __traits(getModuleClasses)); pragma(msg, __traits(getModuleClasses, std.stdio); prints: tuple("test.C") tuple("std.stdio.Stdio.Exception") ".classinfo" can be appended to those strings to get the classinfo for those modules. See: https://dlang.org/spec/property.html#classinfo
Comment #1 by alphaglosined — 2022-12-15T06:53:40Z
Alternatively, return the types, and add a trait for getting the fully qualified name from a symbol (std.traits fullyQualifiedName is absolutely insane). This could also simplify handling of inner classes. This will also take care of getting ClassInfo.
Comment #2 by dlang-bot — 2022-12-15T06:54:13Z
@WalterBright created dlang/dmd pull request #14699 "fix Issue 23558 - add __traits(getModuleClasses [, module name])" fixing this issue: - fix Issue 23558 - add __traits(getModuleClasses [, module name]) https://github.com/dlang/dmd/pull/14699
Comment #3 by dlang-bot — 2023-02-09T09:53:52Z
dlang/dmd pull request #14699 "fix Issue 23558 - add __traits(getModuleClasses [, module name])" was merged into master: - f5aa814506243f72fb8c8eb19ec80871c6d04b47 by Walter Bright: fix Issue 23558 - add __traits(getModuleClasses [, module name]) https://github.com/dlang/dmd/pull/14699
Comment #4 by dlang-bot — 2023-02-22T09:14:42Z
dlang/dmd pull request #14892 "Revert "fix Issue 23558 - add __traits(getModuleClasses [, module name])" was merged into master: - 673092f5d552d6662600b7591307b21dd7774225 by Dennis Korpel: Revert "fix Issue 23558 - add __traits(getModuleClasses [, module name]) (#14699)" This reverts commit 450ba046cf573768df40a966819d50b3cb1f3f89. https://github.com/dlang/dmd/pull/14892