From: Sean Russell Date: 2003-10-08T23:08:25+09:00 Subject: Re: Yielding to a block from a proc? On Wednesday 08 October 2003 08:49, george.marrows@ps.ge.com wrote: ... > def test > proc { yield 123 } # <-- captures block passed to test > end > > p = test { |a| puts "Got #{a}" } > > p.call() > > Though this is fairly weird (does anyone use it?), it's entirely in keeping > with the fact that blocks have access to the blocks that were passed into > their scope: How does that matter? def test x proc { puts x } # x scoped up end def test x proc { x = "foo" # x has been redefined puts x } end I've been following this thread with very little interest; I haven't seen a compelling use case for passing blocks to procs, but I don't see why scoping issues would cause problems -- any more than Proc scoping rules already do, that is. -- --- SER