On 12/11/10, Jonathan M Davis <jmdavisp...@gmx.com> wrote: > 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 >
That's why I think would be great to have constraint blocks. I threw the idea in the air a few days ago, but since it would be a big change I doubt it will be thought about, at least not for D2.