I understand the preference to librarize as much as possible, but I don't think the desire to sacrifice every possible bit of convenience to avoid the tiniest changes to the language is always beneficial. I don't say that implementing everything inside the compiler is good either though, but in many cases some slight changes to the language can make the library solution so much more simple and elegant.

In this case, allowing to name a unittest should be a very simple language change that'll make any library implementation of the rest of the feature more elegant to use, simpler to implement, and more consistent with alternative library implementations.


Another argument in favor of language solution - sometimes the unittests take the better part of the compilation process, especially when the project is a heavily-templated library(Phobos is a prime example). When working on a bug discovered by a unittest, that means you either have to either build all unittests every time you want to check your changes, or copy the unittest code a `main` function and work on it there. If unittest names are part of the language, it could be possible to instruct the compiler to only build a single unittest, which will make the iterations much faster.

Reply via email to