A proposal for better template constraint error reporting.

Jonathan M Davis jmdavisProg at gmx.com
Wed Oct 26 10:16:40 PDT 2011


On Wednesday, October 26, 2011 10:10 bearophile wrote:
> Gor Gyolchanyan:
> > The ddoc comments, preceding parts of template constraints would be
> > used to specify why exactly did the template fail to instantiate, for
> 
> > example:
> Good. Is it possible to do the same thing with unittests?
> 
> /// foo
> unittest {
> assert(false);
> }
> 
> ==>
> foo unittest failed
> 
> 
> But maybe this syntax is better:
> 
> unittest(foo) {
> assert(false);
> }

I'd definitely favor unittest(foo) or unittest("foo") for naming unittest 
blocks (and that's how it's been proposed previously). And since it would 
presumably actually affect the name of the function that the unittest block 
generates, I think that it makes more sense that way rather than making it a 
comment (it also takes up less vertical space).

- Jonathan M Davis


More information about the Digitalmars-d mailing list