Hello, i'am experiencing some non consistent behavior with static
constructors. I wonder if this is some bug or i just don't know
enough of D (most probably!).. Code example bellow:
//--
module main;
import std.stdio;
class B
{
static this()
Btw, i only tested this using v2.065.0 of DMD.
Cheers,
On Sunday, 27 April 2014 at 02:06:14 UTC, Ali Çehreli wrote:
I don't know whether the inconsistency is a bug but according
to documentation, static this inside a module are executed in
lexical order: Static constructors within a module are
executed in the lexical order in which they appear.
On Sunday, 27 April 2014 at 13:31:39 UTC, bearophile wrote:
Is it possible and a good idea to raise a compilation error in
such cases where code tries to use Bar static fields before bar
static this() has run? (But perhaps a more fine-grained error
is needed, that tracks single fields, to