[Issue 23558] New: add __traits(getModuleClasses [, module name])
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Dec 15 06:44:07 UTC 2022
https://issues.dlang.org/show_bug.cgi?id=23558
Issue ID: 23558
Summary: add __traits(getModuleClasses [, module name])
Product: D
Version: D2
Hardware: x86
OS: Windows
Status: NEW
Severity: enhancement
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: bugzilla at digitalmars.com
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
--
More information about the Digitalmars-d-bugs
mailing list