Is it possible to call a delegate at compile time?

ketmar via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jun 22 21:58:07 PDT 2017


Andrew Edwards wrote:

> I desire to call foo() at compile...  As implemented it does not happen, 
> but it's not immediately clear what I am missing. Or is this simply not 
> possible as yet? What is the proper way to redesign this template so that 
> it will execute at compile time?

there are two caveats. the first is `ref` in Args: that won't work for 
arguments in CTFE (it works for nested functions, though).

and second, whith you can't fight right now: "Error: closures are not yet 
supported in CTFE".

so no, even if you'll remove `ref`, it will not work. sorry.


More information about the Digitalmars-d-learn mailing list