Compile time function execution...

Bill Baxter dnewsgroup at billbaxter.com
Thu Feb 15 18:51:13 PST 2007


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.  If I have to write mixin(...) 
everywhere I'm probably just going to end up going with

    writefn("foo %s is %s",  bar, baz);

I was actually thinking of your func!!().  But eh.  It's not so clear 
cut with all these possible forms of mixin()

      mixin("char x;");
      mixin(func());
      mixin(tfunc!());
      mixin("char " ~ "x");
      mixin("char " ~ func());
      mixin("char " ~ tfunc!());

... etc.


--bb



More information about the Digitalmars-d mailing list