From: Joe Van Dyk Date: 2005-07-18T22:40:57+09:00 Subject: Re: ] Re: Ruby has ruined my Java (was Re: Ruby has ruined my C++) On 7/17/05, Lothar Scholz wrote: > Hello tony, > > ts> in tcl/tk you can use this to create a button > > ts> button .b -text "quit" -command {exit} > ts> pack .b > > ts> i'd really like something like this for ruby (off the top of my head): > > ts> class quit_button < button > > ts> def initalize > ts> button_text("quit") > ts> self.show > ts> placeongrid() > ts> # you get the idea > ts> end > > ts> def button_text(t) > ts> quit_text=t > ts> end > > ts> def click > ts> app.cleanup > ts> end > ts> end > > Inheritance just for the purpose to add callbacks/configuration > already proved to be wrong a long time ago. The only framework which > tried this was self, but as self is OO without classes it's not > comparable. > > From the length of your example you should see where the problem is. It is? Most ruby-gnome2 and gtkmm (c++ interface to gtk) examples use inheritance. I generally try to use composition instead, but it's sometimes a lot simpler to use inheritance, especially if it's just a quick application.