Compile time function execution...

Derek Parnell derek at nomail.afraid.org
Thu Feb 15 21:17:07 PST 2007


On Thu, 15 Feb 2007 20:45:04 -0800, Andrei Alexandrescu (See Website For
Email) wrote:


> There's been also much discussion about the applications of code 
> generation, and you can be sure they will be simplified by one order of 
> magnitude by dual functions.

So this would mean that I could code ...

    mixin(
          Conv("moveto 34,56 "
               "drawto +100,-50 "
               "drawto +0,+100 "
               "pencolor red "
               "drawto -100,-50 "
              );
          );

And expect that the Conv function will, at compile time, create the
equivalent D code to implement the 2D drawn item for the target platform,
and have the mixin insert it into the program being compiled. 

-- 
Derek
(skype: derek.j.parnell)
Melbourne, Australia
"Justice for David Hicks!"
16/02/2007 4:06:53 PM



More information about the Digitalmars-d mailing list