From: 7stud -- Date: 2007-09-09T20:28:46+09:00 Subject: Re: Bug in lambda? > This looks like a pretty serious bug. I guess you didn't read p. 51 of "Programming Ruby (2nd Ed)". You can read the first edition online. See the section Implementing Iterators here: http://www.rubycentral.com/pickaxe/tut_containers.html > > As far as remember, Guy Decoux and I are the only two people who think > that this makes perfect sense, once you learn it, and should not be > changed :-) > The behavior in question seems consistent with the way closures work in Ruby: def func(x) y = 10 lambda {puts x+y; y += 1} end p = func(5) p.call p.call p.call --output:-- 15 16 17 Is there something inconsistent with the way a block defined outside of any functions behaves versus a closure? -- Posted via http://www.ruby-forum.com/.