Another use case for __traits(docComment)

Adam D. Ruppe destructionator at
Tue Nov 12 16:23:22 UTC 2019

On Tuesday, 12 November 2019 at 15:14:17 UTC, Steven 
Schveighoffer wrote:
> Alternatively, we could use something other than comments for 
> documentation. e.g.:




that would actually work and the doc generator can recognize the 
pattern too.

But there's a big difference:

struct A {
    int a; /// does something

that is cute syntax and not repeatable with UDAs.

And of course, my big use case is to fetch docs for third party 
libs I'd rather not edit the source of anyway.

Now see, this is an argument against the fear that it will get 
abused though simply because the language has easier ways to do 
other things. Using UDAs for docs is doable but awkward, so we 
prefer to use /++ +/.

Similarly, abusing doc comments as UDAs is going to be more 
awkward than using the real thing - you can use the language to 
structure it and all. So why do things the hard way when there's 
an easy way?

More information about the Digitalmars-d mailing list