From: ara.t.howard@... Date: 2007-02-18T05:27:54+09:00 Subject: Re: Oppinions on RCR for dup on immutable classes On Sun, 18 Feb 2007 Ara.T.Howard@noaa.gov wrote: > On Sun, 18 Feb 2007, Dean Wampler wrote: > >> >> As someone else commented, perhaps the real issue is that >> 5.respond_to?(:dup) returns true yet 5.dup raises, so you have no way of >> knowing in advance that you shouldn't call dup. >> > > i simply do not understand this line of thinking - every call to every object > always has that characteristic > > f.respond_to? :read #=> true > f.gets # EOFError > > q.respond_to? :pop #=> true > q.pop(true) #=> ThreadError if empty > > to me this really seems like a dynamic vs static issue - i just don't see how > ruby can save you, regardless of the impl of dup, or any other method. one > cannot avoid hanlding runtime exceptions in a dynamic language. one cannot > know in advance whether it's ok to call something - even if the object > responds to it. ... or even if it doesn't: method_missing -a -- we can deny everything, except that we have the possibility of being better. simply reflect on that. - the dalai lama