Re: There is nothing cooler than a macr- Err… Mixin?
Philippe Sigaud
philippe.sigaud at gmail.com
Sat Jul 21 06:46:53 PDT 2012
On Sat, Jul 21, 2012 at 2:22 PM, Simen Kjaeraas <simen.kjaras at gmail.com> wrote:
> Great post on D's mixins and Philippe Sigaud's Pegged:
>
> http://idorobots.org/2012/07/20/macro-mixin/
>
> and on Reddit:
>
> http://www.reddit.com/r/programming/comments/wws65/there_is_nothing_cooler_than_a_macr_err_mixin/
I think I just had a geekgasm. Thanks Kajetan, that makes my day!
Is that a code-into-code call right there?
*** LOOP code
with data = $$ // Yo dawg...
mixin(Loope!q{
for i from 0.0 to max by 1.337
collect i
}); $$
***
That's mightily cool!
Another solution could be to add a special syntax ($! ... !$ or
whatever) to insert code into code:
***
with date = $! for i from 0.0 to max by 1.337
collect i
!$
***
Geez, I should be hacking on Pegged right now.
Philippe
More information about the Digitalmars-d
mailing list