D-Programming-Language/dmd — pull request #3531 by MasonMcGill (2014-05-07 04:29:24+00:00)
Title: Adding support for __traits(comment, ...)

`__traits(comment, expr)` now evaluates to the documentation comment on `expr`, if it exists and is available. Comments will only be available if DMD is invoked with the "-D" flag. If no comment is available for `expr`, `__traits(comment, expr)` evaluates to the empty string.

Unlike `__traits(identifier, expr)`, `__traits(comment, expr)` will not report an error if `expr` is not a symbol or anonymous function. It will instead evaluate to the empty string. This is in the interest of ease of use.

This feature is intended to aide automatic wrapper generation, metaprogramming (e.g. forwarding documentation from a template argument), and simplifying documentation generators. It is not intended to be involved in providing application functionality.