Re: nested class inheritance

2011-06-01 Thread Simen Kjaeraas
On Wed, 01 Jun 2011 01:57:52 +0200, Michael Shulman viritril...@gmail.com wrote: I've also realized that my proposed workaround actually doesn't work, because 'alias this' doesn't actually behave like subclassing with respect to references. That is, if Inner2 is 'alias this'ed to Inner1, and

nested class inheritance

2011-05-31 Thread Michael Shulman
Hi, I have a class which defines a nested class: class Outer1 { class Inner1 { } } Now I want to inherit from Outer1, to modify its behavior in a way which also involves modifying the behavior of the corresponding inner objects. My first instinct was to write class Outer2 : Outer1 { class

Re: nested class inheritance

2011-05-31 Thread Simen Kjaeraas
On Tue, 31 May 2011 20:17:23 +0200, Michael Shulman viritril...@gmail.com wrote: I have thought of a workaround with 'alias this': class Outer2 : Outer1 { class Inner2 { Inner1 _self; alias _self this; this() { _self = this.outer.new Inner1(); } } } This seems to

Re: nested class inheritance

2011-05-31 Thread Michael Shulman
On Tue, May 31, 2011 at 2:24 PM, Simen Kjaeraas simen.kja...@gmail.com wrote: I have thought of a workaround with 'alias this': class Outer2 : Outer1 {  class Inner2 {    Inner1 _self;    alias _self this;    this() {      _self = this.outer.new Inner1();    }  } } This seems to work,