On Sunday, 27 September 2015 at 14:10:06 UTC, Jack Stouffer wrote:
On Sunday, 27 September 2015 at 05:01:48 UTC, Jonathan M Davis wrote:
This DIP provides a way to handle unittest blocks inside of templates which works with ddoc without compiling the unittest blocks into each instantiation.

I understand that this DIP solves a genuine problem, so understand that this bike-sheding comment is not a dismissal of the idea.

I think it's a bad idea to further confuse what static means, as it currently has no less than five different distinct uses.

* static ifs
* static array construction
* static assert
* static/shared static this
* static functions/data

Maybe a new keyword or some @attribute would make this clearer.

static in this case is consistent with how static is used on constructors or any symbol at the class or struct level where it makes it so that the symbol is for the class or struct as a whole rather than per instance. For static unittest blocks, it makes it so that the unittest is for the template as a whole and not for a particular instantiation. So, this definitely in line with how static works already, and I think that it would be much worse to add a new keyword or attribute for this. static is the obvious choice IMHO.

- Jonathan M Davis

Reply via email to