From: "Suraj N. Kurapati" Date: 2008-05-28T13:54:06+09:00 Subject: Re: [PATCH] block args w/ defaults (updated) Eric Mahurin wrote: > 2008/5/26 Rados���aw Bu���at : >> I've tried your patch and have some troubles. >> I expected to this code: >> >> def test >> yield >> yield(2) >> end >> >> test {|x=10| p x} >> >> to print >> 10 >> 2 >> >> but it prints >> 10 >> 10 >> >> I've tried also with &block but the same results. > > At the end of this message is an update for this patch that fixes the > above. I confirm that this updated patch fixes the above example: >> def test >> yield >> yield 2 >> end => nil >> test {|x=10| p x} 10 2 => 2 >> f = lambda {|x=8| p x} => # >> test &f 8 2 => 2 >> def test2 &b >> p :b => b >> b.call 15 >> end => nil >> test2 {|x=5,y=10,z=15| p x: x, y: y, z: z} {:b=>#} {:x=>15, :y=>10, :z=>15} => {:x=>15, :y=>10, :z=>15}