Another use case for __traits(docComment)
Adam D. Ruppe
destructionator at gmail.com
Mon Nov 11 17:54:07 UTC 2019
On Monday, 11 November 2019 at 17:16:20 UTC, Steven Schveighoffer
wrote:
> I still am very VERY leery of having anything in comments
> affect the code in any way.
then just.... don't do that.
And btw for the record you could have comments affect code right
now:
mixin((__LINE__ % 3) ? "one thing" : "other thing"); // adding a
comment above would change the line number and possibly trigger
the other thing!
but such a thing is obviously absurd and nobody would write that,
unless maybe doing an obfuscated contest.
The same thing is true of documentation comments. You *could*
abuse... but why would you? UDAs are easier to use for other
purposes anyway. (just right now we are using UDAs for docs just
because it is needed elsewhere!)
> What about a compromise? Provide access to the docs but ONLY at
> runtime. That is, you will not know anything about the string
> at compiletime, just at runtime, and you can make your
> decisions there.
Yeah, that'd work for this case but it is a pointless restriction.
More information about the Digitalmars-d
mailing list