"Dave Burt" <burtdav / hotmail.com> schrieb im Newsbeitrag
news:V94qc.43824$TT.14932 / news-server.bigpond.net.au...
> "Robert Klemme" <bob.news / gmx.net> wrote...
> >
> > And then there is the third idiom:
> >
> > Integer === a
> >
> >...
> >
> > Btw: there's a gotcha with the idiom on the wiki:
> >
> > def fred(*args)
> >   case args.collect { |a| a.type}
> >     when [Float, Fixnum, String]
> >       f, i, s = args
> >       # ...
> >
> >
> > This will not use Class#=== i.e. match only if the arguments' types
match
> > identical (instead of sub classes matching with superclasses for all
the
> > three idioms listed above).
>
>
> My omissions were for simplicity; thanks for expanding, Robert.
>
> Further, just after posting this, I read Tim Bates on duck typing
> [ruby-talk:100516], and was convicted.
>
> A well-designed program will usually not need to do that kind of thing.
> Method overloading like that is a very static-typing thing to do. The
Ruby
> Way often obviates the need for such checks.

Yeah, true.  And *if* different argument lists lead to different behavior,
then it might be better to use different method names anyway.

Regards

    robert