__traits(documentation, X)

Steven Schveighoffer schveiguy at yahoo.com
Thu Jan 18 16:41:04 UTC 2018


On 1/17/18 1:24 PM, Simen Kjærås wrote:
> On Wednesday, 17 January 2018 at 16:52:40 UTC, Steven Schveighoffer wrote:
>> The charter of comments is to NOT affect code, ever. They can be used 
>> to affect other systems, such as the ddoc generator, ide hints, etc., 
>> but you can be sure (?) that comments won't change code.
>>
>> I think this is an important line not to cross.
> 
> That's already perfectly possible today:
> 
> enum a = import(__FILE__);
> static if (a.indexOf("//") > -1) {
>      fireZeMissiles();
> }

Ironically, this doesn't need any comments to trigger :)

Furthermore, I'd ask, if it's possible today, why do we need a __traits 
to do it? Having a __traits option for looking at documentation sounds 
like a very rare need in the first place to warrant promoting such a 
hole in the expectations for comments.

I find this to also be undesirable, and I would flag any code that used 
such a technique as unacceptable in code review.

-Steve


More information about the Digitalmars-d mailing list