From: Sam Goldman Date: 2005-06-02T04:52:49+09:00 Subject: Re: Method Chaining Issues Gyoung-Yoon Noh wrote: >On 6/2/05, Nikolai Weibull > wrote: > > >>It should also be pointed out that the non-destructive version of sub >>(i.e., String#sub) method often turns out to be faster than the >>destructive one (i.e., String#sub!), >> nikolai >> >> >> > >No, what you said are inverted. >Some non-destructive methods are usually implemented by >simply copying reference after calling destructive method. > While everything you said is true, a "smart enough" compiler can do some very interesting optimizations on whole programs if it can assume the idempotence of methods. This is one of the most attractive points of functional programming (that and bringing math back into programming). - Sam