Mixin declarations not showing up in ModuleInfo

Daniel Kozák via Digitalmars-d digitalmars-d at puremagic.com
Sun Nov 30 23:28:13 PST 2014


V Mon, 01 Dec 2014 00:07:10 +0000
bitwise via Digitalmars-d <digitalmars-d at puremagic.com> napsáno:

> > But I just try to say you can omit mixin word in template 
> > declaration. Because it doesn't have any effect.
> 
> mixin != mixin template != template
Yes and no :)

import std.stdio;

mixin template t1() {
    int x = 5;
}

void main(string[] args)
{
    mixin t1;
    writeln(x);
}

is same as:

import std.stdio;

template t1() {
    int x = 5;
}

void main(string[] args)
{
    mixin t1;
    writeln(x);
}



More information about the Digitalmars-d mailing list