mixin template FAIL
H. S. Teoh
hsteoh at quickfur.ath.cx
Thu Feb 23 16:20:15 PST 2012
On Thu, Feb 23, 2012 at 05:27:03PM -0500, Zach the Mystic wrote:
> 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!");
The writeln call is a statement.
I think what you want is this:
template helpMe() {
mixin(`writeln("Satisfying!");`);
}
T
--
Real Programmers use "cat > a.out".
More information about the Digitalmars-d-learn
mailing list