www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17791] New: Add __traits(isDeprecated, ...)

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 puremagic.com
          Reporter: issues.dlang 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).

--
Aug 28 2017