Another use case for __traits(docComment)

Dennis dkorpel at
Wed Nov 13 20:38:07 UTC 2019

On Wednesday, 13 November 2019 at 19:44:38 UTC, Adam D. Ruppe 
> The ONLY addition I am calling for is that a trait docComment 
> (or whatever) returns the ddoc string attached to the 
> declaration

That may be the only thing _you_ want, but then someone else 
comes along who wants something different.
All Manu wanted was a mangle-only `extern(C++, "ns")` as an 
additional option, so simple. Why was Walter initially so 
resistant for such a harmless addition? Then it got merged.

Then the issues come in.

And someone wants to deprecate the old way.

I'm not saying it wasn't worth it in that case, but those 
fictional remarks about __traits(docComment) were supposed to 
show that the trait will be ANOTHER source of enhancement 
requests, introduces ANOTHER thing that can get queried during 
any point of semantic analysis, probably making it ANOTHER source 
of DMD bugs, and it will be ANOTHER source of confusion / 
material for D learners to swallow.

That's just how it goes despite how simple it may look, and the 
question is whether the new trait justifies this cost. Not every 
code annoyance warrants a new feature, sometimes it's better to 
e.g. duplicate a few lines of code instead of introducing another 

Likewise, in this case having some duplication in UDA's or having 
another build step may be the easier solution in the end.

More information about the Digitalmars-d mailing list