mixin functions

Philippe Sigaud philippe.sigaud at gmail.com
Fri Nov 2 10:49:48 PDT 2012


On Fri, Nov 2, 2012 at 12:58 AM, Chris Nicholson-Sauls
<ibisbasenji at gmail.com> wrote:

> Otherwise,
> while ugly, the current anonymous delegate approach isn't the most horrid
> thing imaginable.

Btw, I think (without having compiled this), that the OP code could be
simplified slightly to:

mixin({

    string result;
    foreach(i; 0..10)
        result ~= "writeln(" ~ to!string(i); ~ ");\n"'
    return result;

});

Which is not half bad, but maybe I'm used to string mixins now ;)


More information about the Digitalmars-d mailing list