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 bearophile via Digitalmars-d-learn
spec: 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. If you think this can be done and it's useful, then ask for this enhancement

Re: Static constructors inconsistency

2014-04-27 Thread bearophile via Digitalmars-d-learn
spec: 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. D doesn't like warnings, but it could be an error. This is minimized code:

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

Re: Static constructors inconsistency

2014-04-27 Thread bearophile via Digitalmars-d-learn
spec: I usually try to refrain myself from opinionating on stuff where i lack proper knowledge and i'am still a newbie with D (contrary to you bearophile). It's not just a matter of experience, when there are many interacting parts it's also a matter of intelligence (and people like Timon

Re: Static constructors inconsistency

2014-04-27 Thread bearophile via Digitalmars-d-learn
If no one comment I'll put this in Bugzilla. https://issues.dlang.org/show_bug.cgi?id=12667 Bye, bearophile

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-26 Thread Ali Çehreli via Digitalmars-d-learn
On 04/26/2014 12:10 PM, spec wrote: 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