From: Donglai Gong Date: 2003-06-27T14:31:09+09:00 Subject: Re: method overloading? What is RAA? Is there any documentation for it? Thanks. Donglai On Friday, Jun 27, 2003, at 01:21 US/Eastern, Ryan Pavlik wrote: > On Fri, 27 Jun 2003 13:43:42 +0900 > Donglai Gong wrote: > >> Is there a way to implement method overloading in ruby? Naively I >> just >> defined two methods with the same name with different number of >> parameters...Ruby didn't like that. >> >> Donglai > > > > The StrongTyping module on RAA lets you do this: > > def foo(*args) > overload(args, String) { > ... > return ... > } > > overload(args, String, String) { > ... > return ... > } > > ... > > overload_default args > end > > Of course, if you don't care what type of object you want > specifically, you can just say "Object", and you can specify multiple > types like [String, NilClass]. > > > > > -- > Ryan Pavlik > > "Ye don't like me? But we don't even know each other. I > bets we have a lot in common. Treachery and such. Yar." - 8BT >