compile-time explicitness

Steven Schveighoffer schveiguy at yahoo.com
Fri Sep 23 09:03:44 PDT 2011


On Fri, 23 Sep 2011 11:51:35 -0400, Gor F. Gyolchanyan  
<gor.f.gyolchanyan at gmail.com> wrote:

> I have a proposal to introduce and optional explicit separation of
> compile-time facilities from run-time facilities.
> There is a new keyword, called compiletime (or something similar).
> The keyword can be used with `is` expression to detect whether the  
> current
> scope is executing in compile-time or not.
>
> static if(__traits(compiletime))
> {
>     // ...
> }

static if(__ctfe) does this already

>
> The keyword is a storage class for declarations of variables, types and  
> functions.
>
> A variable, declared with this keyword behaves much like a enum:
>
> compiletime float dmdVersion = 2.055;
>
> This keyword reflects the nature of dmdVersion much better, then the  
> `enum`
> keyword, since it does not actually enumerate anything.
> dmdVersion does not exist at run-time (hence, cannot be taken address  
> of) just
> like enums.

This is a long dead horse, enum is here to stay in its current meaning,  
much as a lot of us don't like it.  You're likely to get nowhere in this  
argument.

All of the rest of your points are solved with static if(__ctfe)

-Steve


More information about the Digitalmars-d mailing list