Error: non-constant expression

Jakob Ovrum jakobovrum at gmail.com
Thu Dec 26 01:05:04 PST 2013


On Thursday, 26 December 2013 at 08:35:58 UTC, Ali Çehreli wrote:
> Are those at module scope (i.e. outside of any function)? 
> Although it can be argued that it should be possible to produce 
> the initial value of b at compile time, it is currently not 
> possible.

To elaborate: the problem is not with the computation of b's 
initializer (duh, it even prints the result in the error 
message), but attempting to retain an associative array created 
at compile-time for runtime.

There is some progress in this area; as of last release (or maybe 
the one before that?), we are able to transfer class instances 
created at compile-time to runtime. It may take some time before 
we gain the same capability for associatve arrays, because their 
implementation is a tangled mess, but it is a work in progress.



More information about the Digitalmars-d-learn mailing list