Compile time function execution...
Frits van Bommel
fvbommel at REMwOVExCAPSs.nl
Fri Feb 16 02:40:19 PST 2007
Lionello Lunesu wrote:
> Frits van Bommel wrote:
>> Lionello Lunesu wrote:
>>> Andrei Alexandrescu (See Website For Email) wrote:
>>>> Walter Bright wrote:
>>>>>
>>>>> 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).
>>>
>>>
>>> But add a "!" to the print, and it's already possible? What extra is
>>> needed, and is that just to get rid of the "!"?
>>
>> You currently also need a mixin() around the print!().
>
> Aha.. Or "before", right?
>
> mixin print!("......");
I think the example requires a string mixin statement, which according
to the spec means parentheses are required[1].
Note that it needs to access variables whose names are specified in the
string argument.
[1]: http://www.digitalmars.com/d/statement.html#MixinStatement
More information about the Digitalmars-d
mailing list