From: Jeffrey Schwab Date: 2006-02-07T22:58:23+09:00 Subject: Re: lazy evaluation? Martin DeMello wrote: > vidar.hokstad@gmail.com wrote: > >>It's your assumption of where the "retry" restarts execution that's >>wrong... Essentially the retry in "repeat" will restart execution right >>before the call to repeat, not at the start of the "repeat" method, >>thus evaluating the arguments again. >> >>You can see that by changing your code so that there's an observable >>side effect of the reevaluation: > > > This seems wrong to me, for precisely the reason you cite - it means > that I can never do something like object.foo(ary.pop), without > physically reading the source of #foo to see whether it calls retry > anywhere. That's like saying you have to read the source of every function before using it, just to make sure it's not going to start deleting things from your hard drive. Retry is a design tool that is appropriate in specific situations; it is not inserted at random in library functions. It should be safe to trust methods not to 'retry' unless you have reason to believe otherwise.