Re: Order of base-class constructor calls

2011-10-12 Thread Steven Schveighoffer
On Tue, 11 Oct 2011 12:40:29 -0400, Andrej Mitrovic andrej.mitrov...@gmail.com wrote: Nope. Private ctors have to be called from within the same module, whether implicit or not: test.d: class Foo { private this() { } // Error: constructor main.Bar.this no match for implicit super() call

Re: Order of base-class constructor calls

2011-10-11 Thread Steven Schveighoffer
On Fri, 07 Oct 2011 18:02:33 -0400, Andrej Mitrovic andrej.mitrov...@gmail.com wrote: Is there any way to enforce the user to call the base-class ctor via super(), so it's the first statement in his class ctor? e.g.: class Base { this(int) { } } class Derived : Base { this(int x) {

Re: Order of base-class constructor calls

2011-10-11 Thread Andrej Mitrovic
Nope. Private ctors have to be called from within the same module, whether implicit or not: test.d: class Foo { private this() { } // Error: constructor main.Bar.this no match for implicit super() call in constructor } import test; class Bar : Foo { this() { } } void main() { auto

Re: Order of base-class constructor calls

2011-10-11 Thread Regan Heath
On Fri, 07 Oct 2011 23:02:33 +0100, Andrej Mitrovic andrej.mitrov...@gmail.com wrote: So I'm looking for some techniques or tricks (or, dare I say, design patterns :x) you guys might have if you've ever ran into this kind of problem. The best I can come up with is a runtime solution: import

Order of base-class constructor calls

2011-10-07 Thread Andrej Mitrovic
Is there any way to enforce the user to call the base-class ctor via super(), so it's the first statement in his class ctor? e.g.: class Base { this(int) { } } class Derived : Base { this(int x) { super(x); // user statements } } The problem I'm having is that Base