Verbose checking of range category

Jonathan M Davis jmdavisProg at gmx.com
Sat Dec 11 11:32:58 PST 2010


On Saturday 11 December 2010 11:06:45 Jesse Phillips wrote:
> Andrei Alexandrescu Wrote:
> > 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
> 
> I think it would be best if DMD would emit which constraint failed. Better
> support for automatically say why would be good too. Basically I like
> bearophile's suggestion to give them more structure. But until then, yes
> do this. It should be everywhere, but ranges a big, and need them now!

It would be great if dmd said which constraint failed, but since you're dealing 
with an arbitary boolean expression, in many cases, would not be particularly 
straightforward to say what failed, and I expect that it would be a _big_ change 
for the compiler.

- Jonathan M Davis


More information about the Digitalmars-d mailing list