compile-time function in a class?
Charlie
charlie.fats at gmail.com
Tue Mar 20 08:33:58 PDT 2007
>> You don't need to mark compile-time functions as static. Functions
are only evaluated at compile-time when they can't possibly be evaluated
at run-time (such as in mixin declarations/statements/expressions or as
initializers of static or global variables). E.g.:
I love compile time functions, but saying 'are only evaluated when they
cant be at run-time' leaves allot to be desired in terms of ease of use.
How do i know for sure its evaluated at run time ? I could use a
pragma , but it seems like we have to follow a very thin line to get
there, it would be extremely nice if we had someway of explicitly
saying 'call this at compile time'. @exampleFunc(); maybe ? That way
instead of guessing we're doing it at compile-time, we could be certain,
and also let the programmer know whats going on , instead of him having
to trace the same thin line.
Charlie
Tyler Knott wrote:
> You don't need to mark compile-time functions as static.
>
> char[] example = exampleFunc(); //This is global, so exampleFunc is executed at compile-time
>
> void func()
> {
> char[] example = exampleFunc(); //Not global or static, so run-time
> }
More information about the Digitalmars-d
mailing list