Compile time function execution...

Frits van Bommel fvbommel at REMwOVExCAPSs.nl
Fri Feb 16 02:07:29 PST 2007


Andrei Alexandrescu (See Website For Email) wrote:
> Walter Bright wrote:
>> Andrei Alexandrescu (See Website For Email) wrote:
>>> This is by far the least interesting application of this stuff. I 
>>> don't even count it when I think of the feature. "Oh, yeah, I could 
>>> compile square root at compile time. How quaint."
>>
>> I agree. I need a better example. Any ideas?
> 
> Well we talked about:
> 
> int a = foo();
> char[] b = bar();
> print("a is $a and b is $b, dammit\n");
> 
> The interesting part is that this will also require you to screw in a 
> couple of extra nuts & bolts (that were needed anyway).

Would this mean a type of function whose return value is automatically 
mixed in? This is getting awfully close to LISP macros... :)

> Smart enums (that know printing & parsing) are another example. But the 
> print() example is simple, of immediate clear benefit, and suggestive of 
> more powerful stuff.



More information about the Digitalmars-d mailing list