From: Charles Oliver Nutter Date: 2007-11-24T10:38:41+09:00 Subject: Re: retry semantics changed Wolfgang N��dasi-Donner wrote: > If the wish is a way to evaluate lazy parameters, but not to evaluate > the receiver again (what can be more that confusing mit a Class and the > initialize method), that a possibility exists with Proc objects. Maybe > additional syntax for lazy evaluation (definition and execution) is more > sexy, but this... > > def do_while(p) > yield while p[] > end > > i = 0 > do_while proc{i<10} do > puts i > i+=1 > end > > ...works. Quite right, and in this case the caller is explicitly accepting that the called method could very likely invoke the passed proc multiple times. Perfectly acceptable. - Charlie