From: ara.t.howard@... Date: 2007-02-18T06:16:34+09:00 Subject: Re: Oppinions on RCR for dup on immutable classes On Sun, 18 Feb 2007, Gregory Brown wrote: > On 2/17/07, ara.t.howard@noaa.gov wrote: >> one cannot >> know in advance whether it's ok to call something - even if the object >> responds to it. > > With this in mind, what do you guys think of this work around? > >>> [sandal@metta payroll_camping]$ irb >>> class Object >>> def dup? >>> dup >>> rescue TypeError >>> false >>> end >>> end > => nil >>> 3.dup? > => false >>> 3.dup? || 3 > => 3 >>> "foo".dup? > => "foo" > same semantics - but nice and clean. -a -- we can deny everything, except that we have the possibility of being better. simply reflect on that. - the dalai lama