From: Harry Ohlsen Date: 2001-11-29T21:14:14+09:00 Subject: [ruby-talk:26883] Re: overload possible? In article , "Rich Kilmer" wrote: > excellent idea...how about this refactoring... > > module Overload > def overload(args, *types) > return if args.length != types.length args.each_index {|i| return if > args[i].type.to_s != types[i].to_s} yield *args > end > def invalid_signature(args) > raise TypeError, "Invalid Signature: #{args.collect {|a| > a.type.to_s}.join(', ')}" > end > end Now, here's an interesting question ... is there any way to get access to the parameters of the calling context? What I'm getting at is, it would be much nicer if one didn't need to pass the "args" parameter to overload() all the time. If overload() could get access to the parameters of the single args parameter of the method that's calling it, that would feel just a little neater. I know about caller(), but if memory serves correctly, that only return an array of strings, not the actual parameters.