Compile time function execution...

Andrei Alexandrescu (See Website For Email) SeeWebsiteForEmail at erdani.org
Thu Feb 15 19:08:52 PST 2007


Bill Baxter wrote:
> Frank Benoit (keinfarbton) wrote:
>> many others asked about explicitly run at compile time, and there is
>> this template solution.
>>
>> doesn't this again end up in a new type?
>>
>> I personally do not like the eval!( func() ) syntax.
>> I think this is a new important feature, worth a new syntax.
>>
>> How about something like
>>
>> func!!()
>> func#()
>>
>> This new call syntax forces a function to run in the compiler.
> 
> 
> I like eval!(func()) for that.
> 
> I keep thinking, though, that some new syntax would sure be nice for 
> mixin(func!(arg)).  It seems that things such as
> 
>    mixin(write!("foo %{bar} is %{baz}"));
> 
> could potentially get very tiresome.

Definitely. That's exactly why dispatch of the same code through 
compile-time and run-time channels, depending on the argument, must be easy.

Andrei



More information about the Digitalmars-d mailing list