Re: Adding empty static this() causes exception

2017-09-13 Thread Biotronic via Digitalmars-d-learn
On Tuesday, 12 September 2017 at 19:59:52 UTC, Joseph wrote: The compiler shouldn't arbitrarily force one to make arbitrary decisions that waste time and money. Like having a type system? Having to do *cast(int*) to interpret a string as an int isn't strictly necessary, and wastes dev time

Re: Adding empty static this() causes exception

2017-09-12 Thread lobo via Digitalmars-d-learn
On Tuesday, 12 September 2017 at 19:59:52 UTC, Joseph wrote: On Tuesday, 12 September 2017 at 10:08:11 UTC, Moritz Maxeiner wrote: [...] The compiler shouldn't arbitrarily force one to make arbitrary decisions that waste time and money. My solution was to turn those static this's in to

Re: Adding empty static this() causes exception

2017-09-12 Thread nkm1 via Digitalmars-d-learn
On Tuesday, 12 September 2017 at 19:59:52 UTC, Joseph wrote: The compiler shouldn't arbitrarily force one to make arbitrary decisions that waste time and money. You might want to educate yourself about arbitrary decisions that waste time and money:

Re: Adding empty static this() causes exception

2017-09-12 Thread Moritz Maxeiner via Digitalmars-d-learn
On Tuesday, 12 September 2017 at 19:59:52 UTC, Joseph wrote: On Tuesday, 12 September 2017 at 10:08:11 UTC, Moritz Maxeiner wrote: On Tuesday, 12 September 2017 at 09:11:20 UTC, Joseph wrote: I have two nearly duplicate files I added a static this() to initialize some static members of an

Re: Adding empty static this() causes exception

2017-09-12 Thread Joseph via Digitalmars-d-learn
On Tuesday, 12 September 2017 at 10:08:11 UTC, Moritz Maxeiner wrote: On Tuesday, 12 September 2017 at 09:11:20 UTC, Joseph wrote: I have two nearly duplicate files I added a static this() to initialize some static members of an interface. On one file when I add an empty static this() it

Re: Adding empty static this() causes exception

2017-09-12 Thread Biotronic via Digitalmars-d-learn
The simplest example of a cycle is probably this: module A; import B; int n1 = 17; static this() { n1 = n2; } // module B; import A; int n2 = 42; static this() { n2 = n1; } What's the value of n1 and n2 after module constructors are run? Since both module constructors can run

Re: Adding empty static this() causes exception

2017-09-12 Thread Biotronic via Digitalmars-d-learn
On Tuesday, 12 September 2017 at 09:11:20 UTC, Joseph wrote: I have two nearly duplicate files I added a static this() to initialize some static members of an interface. On one file when I add an empty static this() it crashes while the other one does not. The exception that happens is

Re: Adding empty static this() causes exception

2017-09-12 Thread Moritz Maxeiner via Digitalmars-d-learn
On Tuesday, 12 September 2017 at 09:11:20 UTC, Joseph wrote: I have two nearly duplicate files I added a static this() to initialize some static members of an interface. On one file when I add an empty static this() it crashes while the other one does not. The exception that happens is

Adding empty static this() causes exception

2017-09-12 Thread Joseph via Digitalmars-d-learn
I have two nearly duplicate files I added a static this() to initialize some static members of an interface. On one file when I add an empty static this() it crashes while the other one does not. The exception that happens is Cyclic dependency between module A and B. Why does this occur on