best/proper way to declare constants ?

someone someone at somewhere.com
Thu Aug 5 15:09:13 UTC 2021


On Thursday, 5 August 2021 at 10:28:00 UTC, Steven Schveighoffer 
wrote:

> H.S. Teoh, I know you know better than this ;) None of this is 
> necessary, you just need `rtValue` for both runtime and CTFE 
> (and compile time parameters)!
>
> Now, the original question is about *associative arrays*, which 
> are a different animal. Those, you actually have to initialize 
> using a static constructor, and does indeed need both an enum 
> and a static immutable, as CTFE currently does not understand 
> runtime AAs. This is a huge issue since you do need silly 
> things like the `if(__ctfe)` statement you wrote, and keep an 
> enum handy for those cases which is identical to the static 
> immutable. We really need to fix this.

When you say "We really need to fix this" you mean that 
*eventually* associative-arrays will be available at compile-time 
?

> -Steve




More information about the Digitalmars-d-learn mailing list