From: Dan Doel Date: 2003-11-26T23:57:12+09:00 Subject: Re: Controlled block variables I actually have wondered in the past why there isn't an #eval that takes a proc (other than as a binding). There's #instance_eval and #module_eval/#class_eval for replacing the object scope of a Proc, but there's no way you can do this: def foo a = 4 b = 5 proc { p a; p b } end def bar(p) a = 7 b = 8 eval p end bar(foo) and get 7 and 8 printed. I realize that Proc objects are closures, but since they're also representations of sections of code, it would be interesting to be able to switch them to dynamic scoping for all the benefits and problems that causes, and using #eval seems like a fairly clean way of denoting that. Of course, I don't know how big a change that would require for Proc and the Ruby interpreter. I'm not familiar with the internals of either. Regards. - Dan