From: "David A. Black" Date: 2003-12-15T01:14:12+09:00 Subject: Re: inplace assignment On Mon, 15 Dec 2003, Simon Strandgaard wrote: > On Sun, 14 Dec 2003 23:59:21 +0900, David A. Black wrote: > >> > >> class MyClass < MyClass > > > > Yikes. I *think* that resorting to that is a reasonably good > > indication that you might want to look for a new program design :-) > > irb(main):001:0> class A < A > irb(main):002:1> def test > irb(main):003:2> super > irb(main):004:2> end > irb(main):005:1> end > TypeError: undefined superclass `A' > from (irb):1 > irb(main):006:0> I assume Tom meant that A would already exist. > Special way of writing recursive methods/classes, which reminds me of > modern c++ design's powerful ideas of recursive classes. > > Is it possible to make classes which inherit from themselves ? Yes, you just have to make sure the class exists in the first place :-) But I can't imagine what good it would do. I'm not even sure in what sense it would be "recursive"; I think all it does is duplicate the method search path needlessly. David -- David A. Black dblack@wobblini.net