__traits(comment) redux what if opt in?

Adam D. Ruppe destructionator at gmail.com
Sun May 31 02:01:26 UTC 2020


On Sunday, 31 May 2020 at 01:53:56 UTC, Avrina wrote:
> This is a pointless restriction, you can still access the 
> string by grabbing the UDA from basically anywhere. It just 
> makes it more obfuscated what is happening.

The point here is to explicitly bridge the doc comment into a UDA 
specifically so you can grab it from anywhere.

The author could also just copy/paste the string into two 
different locations (that's probably what I'll do for my 
immediate need btw). Just that seems silly when the author is 
explicitly trying to bridge these two worlds and the compiler can 
help with minimum chance for surprise.

That's the key difference between this and the previous proposal 
we had to solve this same problem: before, people were concerned 
that a user would depend on a comment that the author has no clue 
about. Here, the author is virtually copy/pasting it so there's 
no surprise on either end.


More information about the Digitalmars-d mailing list