From: MenTaLguY Date: 2005-11-03T11:09:01+09:00 Subject: Re: Anonymous methods, blocks etc. (Cont. 'default block params') On Thu, 2005-11-03 at 09:32 +0900, Trans wrote: > gwtmp01@mac.com wrote: > > Yes it is, but not as an actual implementation. Once again Ruby proves > it's ability to pull rabbits out of hats ;) And while that's plenty > cool, this implemenation using delgate is terribly inefficent. That doesn't mean it's unusable, however. If 90% of your program's time is doing something other than calling methods on these proxied objects directly the extra overhead really might not matter. This might be because, for example: - you're calling an iterator method on the proxied object; you only pay for the initial call, not each iteration - you're getting a reference to another object from an accessor on the proxied object, and mostly work with that other object instead; so you only pay the penalty once to get the reference to that other object - the promised computation is extremely time-consuming Lazy evaluation can also open the door to efficient algorithms which would otherwise be prohibitively difficult to code. -mental