From: Rich Kilmer Date: 2001-11-30T05:00:57+09:00 Subject: [ruby-talk:26955] Re: overload possible? Harry, I realized the same thing after I fired off the post. A "types" method on Array would be nice, but you are right that "args.collect { |a| a.type }" is pretty concise and for the number of times I need it, it will work great. I've enjoyed the thread as well. How cool is is to refactor through a distributed community! And especially thank YOU Nobu Nakada for your innovative approach. -Rich > -----Original Message----- > From: Harry Ohlsen [mailto:harryo@zipworld.com.au] > Sent: Thursday, November 29, 2001 2:55 PM > To: ruby-talk ML; undisclosed-recipients: > Subject: [ruby-talk:26953] Re: overload possible? > > > At this point, I think the mechanism is sufficiently straighforward that > I'd just consider it a programming idiom. Ie, I wouldn't even bother > having a separate class, nor adding an Array#types. > > I think that > > def fred(*args) > case args.collect { |a| a.type} > when [Float, Fixnum, String] > f, i, s = args > # ... > > is sufficiently clear that it stands by itself. > > I think this has been a particularly wonderful thread. It's a really > nice example of taking an idea and moulding it until it feels right (at > least to me).