ch-ch-changes
Nick Sabalausky
a at a.a
Wed Jan 28 22:25:42 PST 2009
"Daniel Keep" <daniel.keep.lists at gmail.com> wrote in message
news:glqu65$15pi$1 at digitalmars.com...
>
>
> Christopher Wright wrote:
>> Don wrote:
>>> [snip]
>>>
>>> Then we get:
>>> static assert(__traits(mixincompiles, comp), "Predicate: " ~ comp ~ "
>>> does not compile");
>>>
>>> mxin(comp);
>>
>> That's certainly prettier.
>
> Still doesn't give the user a reason for WHY their predicate didn't
> compile...
>
> It's a pity we can't do this (or something similar):
>
> template Something(string comp)
> {
> static assert( __traits(mixincompiles, comp),
> "Predicate q{"~comp~"} does not compile, because:\n"
> ~__traits(mixinerrors, comp,
> Something.instantiationFile,
> Something.instantiationLine) );
> }
>
> -- Daniel
I'd much rather see errors and static asserts inside of a template cause the
compiler to automatically output a template instantiation "stack trace" (for
lack of a better term). Ie, list files/lines starting with the deepest
file/line, and then the file/line that instantiated that template, and if
that was also inside a template, then the file/line that instantiated that,
etc.
More information about the Digitalmars-d
mailing list