From: "Mauricio Fernández" Date: 2002-09-27T22:11:06+09:00 Subject: Re: adding overload to ruby On Fri, Sep 27, 2002 at 06:35:49PM +0900, nobu.nokada@softhome.net wrote: > Hi, > > At Fri, 27 Sep 2002 07:00:11 +0900, > Mauricio =?unknown-8bit?Q?Fern=E1ndez?= wrote: > > One foolish way I can think of would be the following: > > > > def do_foo(b) > > # used when b can respond to sort and bar > > end > > > > def do_foo(b) > > # when it has method each > > end > > What about this? ;) > > def do_foo(b {b.respond_to?(:sort) && b.respond_to?(:bar)}) > end A lighter way to express that is needed, and that's why I think this kind of overloading is only syntactic sugar :-) -- _ _ | |__ __ _| |_ ___ _ __ ___ __ _ _ __ | '_ \ / _` | __/ __| '_ ` _ \ / _` | '_ \ | |_) | (_| | |_\__ \ | | | | | (_| | | | | |_.__/ \__,_|\__|___/_| |_| |_|\__,_|_| |_| Running Debian GNU/Linux Sid (unstable) batsman dot geo at yahoo dot com (It is an old Debian tradition to leave at least twice a year ...) -- Sven Rudolph