Aliasing a mixin (or alternative ways to profile a scope)

Dennis dkorpel at gmail.com
Sat Mar 9 09:12:13 UTC 2019


On Friday, 8 March 2019 at 11:42:11 UTC, Simon wrote:
> Thanks, this works flawlessly. Out of interest: what is the 
> "enum" doing there? I had the exact same behaviour in a 
> function before, that I only called at compile-time, so why did 
> it complain then? Can I somehow tell the compiler that a 
> function should only be available at compile-time?

The enum (which in D is not only for enumerations, but also for 
"manifest constants") ensures it is evaluated at compile-time, 
since things are only evaluated at compile-time if they have to.
See also Adam D. Ruppe's post in this thread:
https://forum.dlang.org/post/blaawtdhljjantvgafud@forum.dlang.org


More information about the Digitalmars-d-learn mailing list