Is it acceptable to not parse unittest blocks when unittests are disabled ?

Jonathan M Davis via Digitalmars-d digitalmars-d at puremagic.com
Fri Mar 31 18:33:52 PDT 2017


On Friday, March 31, 2017 17:49:48 Walter Bright via Digitalmars-d wrote:
> One of my longer term goals for DMD is to make it as lazy as possible -
> only parse and do semantic analysis if the result is actually needed. Not
> doing the parse for unused unittest blocks is a step in that direction.
>
> The code is still required to be correct, but the compiler isn't required
> to diagnose it.

There are certainly advantages to having the compiler skip over code where
it can, but it's pretty weird for the language to require that something be
valid and then have the compiler ignore it. That makes it really easy to
have something compile on one compiler but not another. Granted, properly
unit testing and testing code on a variety of platforms (so that all of the
version blocks and static if branches are tested) should catch those issues
regardless, but it does seem a bit off to me for the language to require
something and for the compiler to not care - especially the reference
compiler.

- Jonathan M Davis



More information about the Digitalmars-d mailing list