On Sat, 11 Dec 2010 12:15:31 -0500, Andrei Alexandrescu
<seewebsiteforem...@erdani.org> wrote:
[snip]
This program will generate a valid executable, but will also print
during compilation:
Type int is not a random access range because:
no empty property
no front property
no popFront method
no indexing
no slicing
When a programmer has an odd issue with a range check, turning
verboseness of checks could help.
What do you think?
Andrei
An issue with this is that failed template type checks are both extremely
common and expected in template code: i.e. static
if(isRandomAccessRange!T) {...}. So, you'll get a lot of spurious error
messages slowly. Add in parallel builds, and the last error message won't
even be the one you're looking for. So, while I think the concept is
usefully, I'd view this implementation as an intermediate stepping stone
at best (and a distraction from you fixing other bugs at worse). I'd
recommend, as an alternative, to have specific debug versions of the
checks, i.e. isRandomAccessRangeDebug, as a way to avoid false positives.