Another use case for __traits(docComment)

Adam D. Ruppe destructionator at gmail.com
Wed Nov 13 16:12:31 UTC 2019


On Wednesday, 13 November 2019 at 16:03:55 UTC, Steven 
Schveighoffer wrote:
> It just shouldn't be a comment, which the compiler is supposed 
> to ignore.

The D specification makes a distinction between ordinary comments 
and ddoc comments. ddoc comments are well-defined by the language 
and attached to symbols by parsing rules.

It currently doesn't expose it directly - it only processes it 
into separate files (not ignoring them!) - but I want to change 
that, and appealing to the authority of the status quo isn't much 
of a counterargument.

> The thought of comments *ever* affecting the code is just plain 
> wrong to me. Comments are not code, we should keep that line 
> bright.

I agree for regular comments, but ddoc is already a part of the 
language and processed by the compiler! All I want to do is let 
other parts of the language see it too.

And again, UDAs do a better job at embedding non-doc stuff than 
doc comments. So I really think the risk of people going crazy 
with them is quite small since the alternative is superior for 
this task.


More information about the Digitalmars-d mailing list