finding errors with templates without instantiating them

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Thu Sep 12 12:18:02 PDT 2013


On 9/12/13 9:53 AM, bearophile wrote:
> But there is a another situation, when you don't have much new code
> written. You have just written 5-15 lines of templated code, and you
> have not yet written unittests on it (I write lot of unittests, but
> usually after writing the code), at this early stage I think it's useful
> to have a D compiler that performs simple analysis of the template code,
> to catch the simple mistakes very quickly. This helps me focus on the
> less obvious errors, and then I can write the unittests to catch the
> semantic mistakes of the code.
>
> So I think this feature is not useful the seasoned code you seem to
> refer to; it's useful to catch as soon as possible silly mistakes inside
> just written templated code, that allows the programmer to focus on the
> less obvious bugs and on writing the unittests with high coverage.

I don't buy this. All that work for a fleeting moment. Reminds me of 
that comedic bit - hands-free sanitizer dispensers are for the fraction 
of a second between your hand pushing on the button and your hand 
getting cleaned.

Andrei


More information about the Digitalmars-d mailing list