From: Phlip Date: 2008-07-30T23:10:55+09:00 Subject: Re: How to do methodsoverloading in Shadowfirebird wrote: > I think I'm right in saying that a OOP does not require method overloading? > > It's not needed for inheritance. > It's not needed for polymorphism. How do you polymorph without overloading a method? There are those who define OO _as_ using overloaded (virtual, polymorphic) methods to decouple things. For example, the OS method open() could open a file or a device like a printer. The behavior of write() polymorphs. > The author of the language obviously has an opinion, though: Ruby > allows you to redefine operators, but you can't have multiple > definitions of the same method in the same class. > > Given that Ruby is typeless, I'm not sure how it would be otherwise. Ruby is strongly typed, dynamic, and extensible, permitting Monkey Patching. For example, just yesterday we needed the Rails number_to_currency method to implement its :negative_parens option. That's not published yet, so we looked up its patch and pasted it into our code directly. Problem solved - and note this is a kind of polymorph. You can't have the old method back, though! -- Phlip