From: Louis Brothers Date: 2001-08-16T22:45:45+09:00 Subject: [ruby-talk:19896] Re: Why not?: Assigning to self From: Pit Capitain [mailto:pit@capitain.de] >To make it clear what I was thinking of (substituting rectangle for >ellipse and square for circle): > >class Rectangle > def set_size( width, height ) > if width == height > become Square.new( width ) > else > @width, @height = width, height > end > end >end > >class Square < Rectangle > def set_size( width, height ) > if width == height > super > else > become Rectangle.new( width, height ) > end > end >end Perhaps it is only because of the example used, but couldn't #become really be replaced simply and similarly with call to create a new object (or something along those lines)? While I can see #become as a useful tool in some instances, I keep thinking that there are other ways to program the same thing without "going this far". Granted the overhead created by other methodologies might be higher, but it saves implementing this super-tool and the concerns it brings with it. - Lou Brothers