From: Ryan Pavlik Date: 2003-05-10T01:27:41+09:00 Subject: Re: methods with different signatures On Fri, 9 May 2003 20:32:58 +0900 KONTRA Gergely wrote: > Hi! > > There was a thread about a little typechecking to ruby. > What's the status of this? I wrote a little module for just this. Check out 'StrongTyping' on RAA: http://raa.ruby-lang.org/list.rhtml?name=strongtyping You can do this: def fn(*args) overload(args, String, String) { ... } overload(args, Integer, Integer) { ... } overload_default args end This dispatches properly on 'args', otherwise gives an error. You can also use it on single functions: def fn2(a, b, c) expect(a, String, b, Symbol, c, String) ... end as well as being able to query a function for its types, etc. HTH, -- Ryan Pavlik "Why do I even try to share my *fabulous* wit with you?" - 8BT