[Issue 17791] New: Add __traits(isDeprecated, ...)

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Aug 28 14:29:15 PDT 2017


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

          Issue ID: 17791
           Summary: Add __traits(isDeprecated, ...)
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: issues.dlang at jmdavisProg.com

There is currently no way to test whether a particular symbol is deprecated.
This isn't commonly needed, but it can matter when doing introspection on all
of the symbols within a module or class and generating code based on the list
of symbols, since skipping deprecated symbols in those cases would be required
to avoid creating deprecation warnings, and if someone actually used -de, then
the code could not compile because of the inadvertent use of deprecated
symbols, and there would be no way to avoid using those deprecated symbols,
since there's currently no way to introspect whether a symbol is deprecated or
not.

functionAttributes could be improved to include deprecated, but that would only
cover functions, and just about any symbol can be deprecated, so I would
suggest simply adding a new trait to do the test. e.g. __traits(isDeprecated,
symbol).

--


More information about the Digitalmars-d-bugs mailing list