mixin template FAIL

Zach the Mystic reachzachatgooglesmailservice at dot.com
Thu Feb 23 14:27:03 PST 2012


On 2/21/12 2:53 PM, Ali Çehreli wrote:
> According to the docs, template mixins can have only declarations but
> helpMe above has a statement.
>
> http://dlang.org/template-mixin.html
>
> Ali
>

Thanks for your reply. You're right about the statement. But I still 
think something's wrong. For example, even this program produces the errors:

import std.stdio;

mixin template helpMe()
{
    writeln("Satisfying!");
}

void main(){}

test.d(5): unexpected ( in declarator
test.d(5): basic type expected, not "Satisfying!"
test.d(5): found '"Satisfying!"' when expecting ')'
test.d(5): no identifier for declarator writeln(int)
test.d(5): semicolon expected following function declaration
test.d(5): Declaration expected, not ')'

The parser just isn't recognizing the presence of the template mixin 
format. The errors happen instantly, which generally happens only when 
you have parser errors. I don't know, but I think there might be some 
stupid typo in the source code for the current dmd I'm using (2.057 Mac 
OSX 10.6). I'd have to download another version, but I was distracted by 
other things.

Zach


More information about the Digitalmars-d-learn mailing list