From: Logan Capaldo Date: 2005-10-10T17:15:37+09:00 Subject: Re: using lambda/Proc can prevent a lot of garbage collection On Oct 9, 2005, at 11:31 PM, Trans wrote: > > Logan Capaldo wrote: > > >> really don't believe thats necessary. Can anyone come up with a use >> for an eval taking a string that CAN'T be acheieved by an eval that >> takes a block? (well, irb I suppose). >> > > No closure. > > T. > > > Yes, but if eval only took a block the closure could be over exactly what was referenced in the block instead of (relatively) everything. eg. x = 2 lambda { eval("y = 2; puts y") }.call # x is in the closure vs. x = 2 eval { y = 2; puts y } # x isn't in the closure cause its guaranteed not to reference it