Templates are way lazy. Is this expected behaviour?

Janice Caron caron800 at googlemail.com
Fri Apr 25 22:52:05 PDT 2008


On 25/04/2008, Ary Borenszweig <ary at esperanto.org.ar> wrote:
>  So, basically, I can change a template's instantiation by overriding the
> symbols it uses. Is that expected behaviour?

Yes.

But there is a way of unhiding it. Just give the mixin instantiation a name.

    module main;

    import std.stdio;
    import other;

    class Something {
       char[] nameX = "main";
    }

    mixin Foo!() foo;

   void main() {
       writefln("%s", foo.something.name);
    }



More information about the Digitalmars-d mailing list