Static constructors inconsistency
spec via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun Apr 27 03:54:42 PDT 2014
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."
>
> http://dlang.org/class.html#StaticConstructor
>
> So, if B depends on A then A's static this must appear before
> B's.
>
> Ali
Arghh i hate when i make a mistake because i missed something on
the docs, mainly when i actually read them. Thanks Ali.
Although, yeah, it would be nice if the compiler emitted some
kind of warning pointing this (if it's at all possible). What got
me confused was indeed the disparity of results from changing
small things.
Cheers,
More information about the Digitalmars-d-learn
mailing list