From: Austin Ziegler Date: 2003-09-13T07:38:09+09:00 Subject: Re: Mthod redefinition Ferenc's code does, more or less, what Ryan Pavlik's StrongTyping module does. However, with the exception of nil testing, you may feel more comfortable with duck typing. For your simple case, it might be: class Bar def foo(arg = nil) return "Who gives no input will get no output." if arg.nil? return "One gives me #{arg}." end end arg is, of course, not limited to integers at this point. The question would then become what is it that you wish to do with integers that you need the value? Duck typing is based mostly on realising what sort of operations you want to do with the object and testing for those operations, rather than testing for the class. As Dave is fond of saying: type and class aren't the same. -austin -- austin ziegler * austin@halostatue.ca * Toronto, ON, Canada software designer * pragmatic programmer * 2003.09.12 * 18.29.32