Another use case for __traits(docComment)

Adam D. Ruppe destructionator at
Thu Nov 14 12:33:02 UTC 2019

On Thursday, 14 November 2019 at 03:17:38 UTC, Steven 
Schveighoffer wrote:
> This is always the argument against named parameters (you 
> changed parameter X's name, and it broke my code).

And it is wrong there too! Doubly so, especially because 
parameter names are already exposed by CT reflection. (I use it 
on my web generator to make nice function forms, for example. But 
this isn't black magic only I know - see Phobos' 

You can leave names out when just interfacing with precompiled 
code, in which case they would not be accessible, same as a 
interface file without comments.

Of course, I'm also of the opinion that documentation is more 
important than code. If something appears in the documentation 
without a special warning, it is a solid part of the interface 
and cannot change. If not, it is undefined behavior and you rely 
on it at you own risk. Parameter names are documented.

> Isn't that what commit hooks are for? ;)

Most of D's ctfe stuff could be done by external build system 
things.... often more efficiently too... but it is still really 
nice to have in there.

More information about the Digitalmars-d mailing list