On 1/18/18 4:01 PM, Adam D. Ruppe wrote:
On Thursday, 18 January 2018 at 20:35:54 UTC, Steven Schveighoffer wrote:
In any case, I stand by my assertion -- comments should be comments,
not code.
Note that we aren't talking about comments. We're talking about ddoc
strings. They just have very similar appearance to comments, but they
are distinct entities defined by D to be part of the AST (and the
compiler will parse their contents too if you ask it to!), unlike
regular comments which are discarded before parsing.
Hm... I don't see where Ddoc comments are defined separately from
comments in the grammar. How they are stored internally is up to the
compiler, and as far as I know, the D *language* makes no guarantees on
what comes out:
"The specification for the form of embedded documentation comments only
specifies how information is to be presented to the compiler. It is
implementation-defined how that information is used and the form of the
final presentation."
This brings up another thing: What if the compiler you are using decides
to do something completely different with the documentation (or maybe
even nothing)? Then __traits(documentation, X) may be completely
different and cause different code to be generated.
-Steve