inheriting constructos

2009-11-29 Thread Andrei Alexandrescu
Walter and I just discussed the matter of inheriting constructors. Our thought on the issue: a) If a class doesn't define any constructors and adds no fields, inherit constructors. Example: class MyException : Exception {} b) If a class defines at least one constructor, do not inherit constr

Re: inheriting constructos

2009-11-29 Thread bearophile
Andrei Alexandrescu: > c) If a class doesn't define any constructors but does add at least a > non-static field -> undecided. Does 'undecided' mean 'compile-time error'?" Bye, bearophile

Re: inheriting constructos

2009-11-29 Thread Denis Koroskin
On Mon, 30 Nov 2009 02:20:40 +0300, bearophile wrote: Andrei Alexandrescu: c) If a class doesn't define any constructors but does add at least a non-static field -> undecided. Does 'undecided' mean 'compile-time error'?" Bye, bearophile I think it means they are not decided whether it s

Re: inheriting constructos

2009-11-29 Thread Andrei Alexandrescu
Denis Koroskin wrote: On Mon, 30 Nov 2009 02:20:40 +0300, bearophile wrote: Andrei Alexandrescu: c) If a class doesn't define any constructors but does add at least a non-static field -> undecided. Does 'undecided' mean 'compile-time error'?" Bye, bearophile I think it means they are no

Re: inheriting constructos

2009-11-29 Thread Andrei Alexandrescu
bearophile wrote: Andrei Alexandrescu: c) If a class doesn't define any constructors but does add at least a non-static field -> undecided. Does 'undecided' mean 'compile-time error'?" We're undecided. Andrei

Re: inheriting constructos

2009-11-29 Thread Denis Koroskin
On Mon, 30 Nov 2009 03:18:27 +0300, Andrei Alexandrescu wrote: Denis Koroskin wrote: On Mon, 30 Nov 2009 02:20:40 +0300, bearophile wrote: Andrei Alexandrescu: c) If a class doesn't define any constructors but does add at least a non-static field -> undecided. Does 'undecided' mean '

Re: inheriting constructos

2009-11-29 Thread bearophile
Denis Koroskin: > Unfortunately, this conflicts with alias this feature. If we could rename > constructors from "this" to "ctor", we could use it with no ambiguity: That's another keyword, I think. When I read that word it reminds me this word: http://www.legrog.org/visuels/couvertures/71.jpg

Re: inheriting constructos

2009-11-29 Thread Nick Sabalausky
"Andrei Alexandrescu" wrote in message news:heuuk9$1nf...@digitalmars.com... > Walter and I just discussed the matter of inheriting constructors. Our > thought on the issue: > > a) If a class doesn't define any constructors and adds no fields, inherit > constructors. Example: > > class MyExcept

Re: inheriting constructos

2009-11-30 Thread Don
Andrei Alexandrescu wrote: Walter and I just discussed the matter of inheriting constructors. Our thought on the issue: a) If a class doesn't define any constructors and adds no fields, inherit constructors. Example: class MyException : Exception {} b) If a class defines at least one constr

Re: inheriting constructos

2009-11-30 Thread davidl
在 Mon, 30 Nov 2009 09:35:17 +0800,Denis Koroskin <2kor...@gmail.com> 写道: On Mon, 30 Nov 2009 03:18:27 +0300, Andrei Alexandrescu wrote: Denis Koroskin wrote: On Mon, 30 Nov 2009 02:20:40 +0300, bearophile wrote: Andrei Alexandrescu: c) If a class doesn't define any constructors but

Re: inheriting constructos

2009-11-30 Thread Ary Borenszweig
Andrei Alexandrescu wrote: Walter and I just discussed the matter of inheriting constructors. Our thought on the issue: a) If a class doesn't define any constructors and adds no fields, inherit constructors. Example: class MyException : Exception {} b) If a class defines at least one constr

Re: inheriting constructos

2009-11-30 Thread Nick Sabalausky
"Ary Borenszweig" wrote in message news:hf03ps$lk...@digitalmars.com... > Andrei Alexandrescu wrote: >> Walter and I just discussed the matter of inheriting constructors. Our >> thought on the issue: >> >> a) If a class doesn't define any constructors and adds no fields, inherit >> constructors

Re: inheriting constructos

2009-11-30 Thread Andrei Alexandrescu
Don wrote: Andrei Alexandrescu wrote: Walter and I just discussed the matter of inheriting constructors. Our thought on the issue: a) If a class doesn't define any constructors and adds no fields, inherit constructors. Example: class MyException : Exception {} b) If a class defines at leas

Re: inheriting constructos

2009-11-30 Thread Don
Andrei Alexandrescu wrote: Don wrote: Andrei Alexandrescu wrote: Walter and I just discussed the matter of inheriting constructors. Our thought on the issue: a) If a class doesn't define any constructors and adds no fields, inherit constructors. Example: class MyException : Exception {} b

Re: inheriting constructos

2009-11-30 Thread Michel Fortin
On 2009-11-29 18:03:40 -0500, Andrei Alexandrescu said: Walter and I just discussed the matter of inheriting constructors. Our thought on the issue: a) If a class doesn't define any constructors and adds no fields, inherit constructors. Example: class MyException : Exception {} b) If a c

Re: inheriting constructos

2009-11-30 Thread Michel Fortin
On 2009-11-30 10:30:11 -0500, Andrei Alexandrescu said: class MyException : Exception { private int sysCode; invariant() { assert(sysCode < 100); } } If default initialization of the field puts it in a state that respects the invariant, there isn't a problem. I think this simply

Re: inheriting constructos

2009-11-30 Thread Sean Kelly
Andrei Alexandrescu Wrote: > Walter and I just discussed the matter of inheriting constructors. Our > thought on the issue: > > a) If a class doesn't define any constructors and adds no fields, > inherit constructors. Example: > > class MyException : Exception {} > > b) If a class defines at

Re: inheriting constructos

2009-11-30 Thread Sean Kelly
Michel Fortin Wrote: > On 2009-11-29 18:03:40 -0500, Andrei Alexandrescu > said: > > > Walter and I just discussed the matter of inheriting constructors. Our > > thought on the issue: > > > > a) If a class doesn't define any constructors and adds no fields, > > inherit constructors. Example:

Re: inheriting constructos

2009-11-30 Thread Ary Borenszweig
Nick Sabalausky wrote: "Ary Borenszweig" wrote in message news:hf03ps$lk...@digitalmars.com... Andrei Alexandrescu wrote: Walter and I just discussed the matter of inheriting constructors. Our thought on the issue: a) If a class doesn't define any constructors and adds no fields, inherit co

Re: inheriting constructos

2009-11-30 Thread Sean Kelly
Ary Borenszweig Wrote: > Nick Sabalausky wrote: > > "Ary Borenszweig" wrote in message > > news:hf03ps$lk...@digitalmars.com... > >> Andrei Alexandrescu wrote: > >>> Walter and I just discussed the matter of inheriting constructors. Our > >>> thought on the issue: > >>> > >>> a) If a class does

Re: inheriting constructos

2009-12-01 Thread Michel Fortin
On 2009-11-30 18:45:38 -0500, Ary Borenszweig said: Nick Sabalausky wrote: "Ary Borenszweig" wrote in message news:hf03ps$lk...@digitalmars.com... Andrei Alexandrescu wrote: c) If a class doesn't define any constructors but does add at least a non-static field -> undecided. What do you th

Re: inheriting constructos

2009-12-02 Thread Ary Borenszweig
Michel Fortin wrote: On 2009-11-30 18:45:38 -0500, Ary Borenszweig said: Nick Sabalausky wrote: "Ary Borenszweig" wrote in message news:hf03ps$lk...@digitalmars.com... Andrei Alexandrescu wrote: c) If a class doesn't define any constructors but does add at least a non-static field -> undec

Re: inheriting constructos

2009-12-04 Thread Lionello Lunesu
Perhaps reusing a constructor of an inherited class should be easier. Something like "alias this"? But how to refer to specific ctor overloads? L. On 30-11-2009 1:03, Andrei Alexandrescu wrote: Walter and I just discussed the matter of inheriting constructors. Our thought on the issue: a) If

Re: inheriting constructos

2010-03-07 Thread Michael Rynn
On Fri, 04 Dec 2009 10:05:16 +0200, Lionello Lunesu wrote: > Perhaps reusing a constructor of an inherited class should be easier. > Something like "alias this"? But how to refer to specific ctor > overloads? > > L. > > On 30-11-2009 1:03, Andrei Alexandrescu wrote: >> Walter and I just discusse