Thread overview
Re: There is nothing cooler than a macr- Err… Mixin?
Jul 21, 2012
Philippe Sigaud
Jul 21, 2012
Kajetan Rzepecki
Jul 21, 2012
Kajetan Rzepecki
Jul 21, 2012
Nick Sabalausky
July 21, 2012
On Sat, Jul 21, 2012 at 2:22 PM, Simen Kjaeraas <simen.kjaras@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
July 21, 2012
On 7/21/12 9:46 AM, Philippe Sigaud wrote:
> I think I just had a geekgasm.

Yah, same here (in abstract that is). Do you know the author?

> Geez, I should be hacking on Pegged right now.

Yes please. I've shown a Pegged example at OSCON (see my slides towards the end) and there were quite a few "bouche bée"s.


Andrei
July 21, 2012
On Saturday, 21 July 2012 at 16:42:55 UTC, Andrei Alexandrescu wrote:
> Do you know the author?

That would be me.

I'm very pleased both of you liked it, I didn't expect my lousy loop to get that much attention. :)

Kajtek
July 21, 2012
On 7/21/12 3:00 PM, Kajetan Rzepecki wrote:
> On Saturday, 21 July 2012 at 16:42:55 UTC, Andrei Alexandrescu wrote:
>> Do you know the author?
>
> That would be me.
>
> I'm very pleased both of you liked it, I didn't expect my lousy loop to
> get that much attention. :)
>
> Kajtek

Awesome. Oh, so you're the roman numerals guy from a while ago (http://idorobots.org/2012/03/04/romans-rubies-and-the-d/) which used to crash the compiler but not anymore. Cool!

Are you interested in furthering your involvement with D (e.g. the standard library)? If you lurk in here, you sure know we're on the lookout for creative, ingenious contributors.


Cheers,

Andrei
July 21, 2012
On Saturday, 21 July 2012 at 19:53:09 UTC, Andrei Alexandrescu wrote:
>
> Awesome. Oh, so you're the roman numerals guy from a while ago (http://idorobots.org/2012/03/04/romans-rubies-and-the-d/) which used to crash the compiler but not anymore. Cool!
>
> Are you interested in furthering your involvement with D (e.g. the standard library)? If you lurk in here, you sure know we're on the lookout for creative, ingenious contributors.
>
>
> Cheers,
>
> Andrei

If anything I do is deemed useful I sure wouldn't mind adding it to the standard library, however, my general "hacking about" tends to be rather far from useful ;)

I'm probably going to expand on the idea behind the Loop template and create a set of functions for use with D code generation (so DSLs mainly) as it seems to be a little tedious at the moment.

By the way, I've managed to crash the compiler once or twice with the Loop template on my way here ;)
I have yet to find a minimal test case for that, tho.
July 21, 2012
On Sat, 21 Jul 2012 22:17:37 +0200
"Kajetan Rzepecki" <kajetan.rzepecki+idorobots@gmail.com> wrote:
> 
> By the way, I've managed to crash the compiler once or twice with
> the Loop template on my way here ;)
> I have yet to find a minimal test case for that, tho.

DustMite can help with that: https://github.com/CyberShadow/DustMite/wiki