mixin functions

Manu turkeyman at gmail.com
Fri Nov 2 13:03:22 PDT 2012


On 1 November 2012 17:58, Gor Gyolchanyan <gor.f.gyolchanyan at gmail.com>wrote:

> OR, better yet:
>
> mixin MyMixin
> {
>     foreach(i; 0..10)
>         MyMixin ~= "writeln(" ~ to!string(i); ~ ");\n"'
> }
>
> And this could be printed out as a pragma(msg, ...) or into a .log file or
> anywhere else. This way it's easy to see what did end up being mixed in.
>

I bumped into this today actually. It's certainly a nice idea.

I see a lot of noise about said AST macros...
I understand the idea, but I have no idea how it might look in practice.
Are there any working proposals?
I find myself using mixins waaaay too much. They're just too convenient,
and enable lots of things that just aren't possible any other way. But I
always feel really dirty! It can be so tedious dealing with all the string
mess.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20121102/94dcb85d/attachment.html>


More information about the Digitalmars-d mailing list