On 1/18/18 11:48 AM, Adam D. Ruppe wrote:
On Thursday, 18 January 2018 at 16:41:04 UTC, Steven Schveighoffer wrote:
Furthermore, I'd ask, if it's possible today, why do we need a
__traits to do it?
It is an enormous pain to do it now.... well, sort of, actually, the way
I'd do it now is do a two-step makefile, where step 1 runs a ddoc
generator and step 2 import("generated.html") it.
This is how I'd imagine doing something like this. I don't see it being
a huge pain, just an extra build step.
But, for stuff like little command line arg stuff, or web interface
creation, it is nice to be able to print that data more conveniently.
Any code that uses it in an evil way should be stupid, but
writeln(__traits(documentation, foo)) is useful and not really harmless.
Did you mean not really harmful?
But in any case, the idea that comments affect the file you are
compiling *right now*, and not some other tool-generated file makes me
very nervous. Comments are supposed to not affect the code. Consider
that with this feature, the documentation now becomes part of the API.
-Steve