Static constructors inconsistency

2014-04-26 Thread spec via Digitalmars-d-learn
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()

Re: Static constructors inconsistency

2014-04-26 Thread spec via Digitalmars-d-learn
Btw, i only tested this using v2.065.0 of DMD. Cheers,

Re: Static constructors inconsistency

2014-04-27 Thread spec via Digitalmars-d-learn
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.

Re: Static constructors inconsistency

2014-04-27 Thread spec via Digitalmars-d-learn
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