On Mon, Mar 12, 2012 at 01:55:33PM -0400, Jonathan M Davis wrote: [...] > So, no, I don't think that @ctfe would really work. And while I agree > that the situation isn't exactly ideal, I don't really see a way > around it. Unit tests _do_ catch it for you though. The only thing > that they can't catch is whether the template is going to be pure, > nothrow, @safe, and/or CTFEable with _your_ arguments to it, but as > long as it's pure, nothrow, @safe, and/or CTFEable with _a_ set of > arguments, it will generally be the fault of the arguments when such a > function fails to be pure, nothrow, @safe, and/or CTFEable as > expected. If the unit tests don't hit all of the possible static > if-else blocks and all of the possible code paths for CTFE, it could > still be a problem, but that just means that the unit tests aren't > thorough enough, and more thorough unit tests will fix the problem, as > tedious as it may be to do that. [...]
Tangential note: writing unit tests may be tedious, but D's inline unittest syntax has alleviated a large part of that tedium. So much so that I find myself writing as much code in unittests as real code. Which is a good thing, because in the past I'd always been too lazy to write any unittests at all. T -- Ruby is essentially Perl minus Wall.
