Why cannot scopes be used in template mixins?

Lutger lutger.blijdestijn at gmail.com
Tue Oct 19 07:29:35 PDT 2010


Justin Johansson wrote:

> For example:
> 
> private string THIS_MODULE_NAME = "abc.def";
> 
> mixin template MyCorporationStandardUnitTest()
> {
> scope(success) {
> writeln( THIS_MODULE_NAME ~ " unittest passed");
> }
> 
> scope(failure) {
> writeln( THIS_MODULE_NAME ~ " unittest failed");
> }
> }
> 
> 
> I think the D spec does not say this is allowed, but why not?
> 
> Thanks in advance for answers,
> 
> Justin

Only declarations are allowed in templates, no statements.


More information about the Digitalmars-d mailing list