digitalmars.D.announce - DIP1004: Inherited Constructors
- Dicebot (17/17) Nov 27 2016 protected-headers="v1"
- rikki cattermole (4/13) Nov 27 2016 A few errors like this are in it:
- Dicebot (13/31) Nov 29 2016 protected-headers="v1"
- Arafel (27/37) Nov 29 2016 I think I might be a bit late to the party, and I'm still quite
- Dicebot (14/41) Nov 29 2016 protected-headers="v1"
protected-headers="v1" From: Dicebot <public dicebot.lv> Newsgroups: d,i,g,i,t,a,l,m,a,r,s,.,D,.,a,n,n,o,u,n,c,e Subject: DIP1004: Inherited Constructors --j0vB8RSNEFOSvTc099tSEoLnkhphwtBJ3 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable DIP 1004 is merged to the queue and open for public informal feedback. PR: https://github.com/dlang/DIPs/pull/42 Initial merged document: https://github.com/dlang/DIPs/blob/master/DIPs/DIP1004.md If you want the change to be approved and have ideas how to improve it to better match on https://github.com/dlang/DIPs/blob/master/GUIDELINES.md and existing published reviews - please submit new PR with editorial and ping original author. --j0vB8RSNEFOSvTc099tSEoLnkhphwtBJ3--
Nov 27 2016
On 28/11/2016 3:38 PM, Dicebot wrote:DIP 1004 is merged to the queue and open for public informal feedback. PR: https://github.com/dlang/DIPs/pull/42 Initial merged document: https://github.com/dlang/DIPs/blob/master/DIPs/DIP1004.md If you want the change to be approved and have ideas how to improve it to better match on https://github.com/dlang/DIPs/blob/master/GUIDELINES.md and existing published reviews - please submit new PR with editorial and ping original author.A few errors like this are in it: class ParseException : Exception { } {
Nov 27 2016
protected-headers="v1" From: Dicebot <public dicebot.lv> Newsgroups: d,i,g,i,t,a,l,m,a,r,s,.,D,.,a,n,n,o,u,n,c,e Subject: Re: DIP1004: Inherited Constructors References: <o1g5a9$2r3l$1 digitalmars.com> <o1g6fc$2t0o$1 digitalmars.com> In-Reply-To: <o1g6fc$2t0o$1 digitalmars.com> --JFPE4HwCdV43sq6LRRXcbSJbfmq31I2wQ Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 11/28/2016 04:57 AM, rikki cattermole wrote:On 28/11/2016 3:38 PM, Dicebot wrote:DIP 1004 is merged to the queue and open for public informal feedback.=PR: https://github.com/dlang/DIPs/pull/42 Initial merged document: https://github.com/dlang/DIPs/blob/master/DIPs/DIP1004.md If you want the change to be approved and have ideas how to improve it=Would you mind a PR? :) I am afraid my eyes are too sloppy after re-reading the text too many times. --JFPE4HwCdV43sq6LRRXcbSJbfmq31I2wQ--to better match on https://github.com/dlang/DIPs/blob/master/GUIDELINES.md and existing published reviews - please submit new PR with editorial and ping original author.=20 A few errors like this are in it: =20 class ParseException : Exception { } {
Nov 29 2016
On Monday, 28 November 2016 at 02:38:00 UTC, Dicebot wrote:DIP 1004 is merged to the queue and open for public informal feedback. PR: https://github.com/dlang/DIPs/pull/42 Initial merged document: https://github.com/dlang/DIPs/blob/master/DIPs/DIP1004.md If you want the change to be approved and have ideas how to improve it to better match on https://github.com/dlang/DIPs/blob/master/GUIDELINES.md and existing published reviews - please submit new PR with editorial and ping original author.I think I might be a bit late to the party, and I'm still quite new in D... but wouldn't a variadic template constructor work? The usual rules of templates would still let you override a constructor if needed. --- class A { this() { } this(int a) { } } class B : A { // Here we inherit all of A's constructors. this(Args...)(Args args) { super(args); } this(string s) { } } void main() { B b1 = new B(42); B b2 = new B("foo"); } --- I've been playing with it, and the only problems I can see are with specialization and casting (i.e. B defines this(float), but you want to call A's this(int), the int will be promoted to float and B's version will be used). A way of disabling them would be needed, though... perhaps assert(0)?
Nov 29 2016
protected-headers="v1" From: Dicebot <public dicebot.lv> Newsgroups: d,i,g,i,t,a,l,m,a,r,s,.,D,.,a,n,n,o,u,n,c,e Subject: Re: DIP1004: Inherited Constructors References: <o1g5a9$2r3l$1 digitalmars.com> <zhemjhreqduwopsoakuw forum.dlang.org> In-Reply-To: <zhemjhreqduwopsoakuw forum.dlang.org> --wupGjUeqKmm16MQaEpxrKlvBvNGD4CtKw Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 11/29/2016 12:04 PM, Arafel wrote:I think I might be a bit late to the party, and I'm still quite new in D... but wouldn't a variadic template constructor work? The usual rules=of templates would still let you override a constructor if needed. =20 --- class A { this() { } this(int a) { } } class B : A { // Here we inherit all of A's constructors. this(Args...)(Args args) { super(args); } this(string s) { } } void main() { B b1 =3D new B(42); B b2 =3D new B("foo"); } --- =20 I've been playing with it, and the only problems I can see are with specialization and casting (i.e. B defines this(float), but you want to=call A's this(int), the int will be promoted to float and B's version will be used). A way of disabling them would be needed, though... perhaps assert(0)?Have just answered a similar question in a PR thread: https://github.com/dlang/DIPs/pull/42#issuecomment-263562276 --wupGjUeqKmm16MQaEpxrKlvBvNGD4CtKw--
Nov 29 2016