From: Brian Mitchell Date: 2009-01-14T04:12:20+09:00 Subject: [ruby-core:21317] Re: Proc-as-Binding is out again? It seems to be more interface based rather than disallowing the access of Proc bindings. Proc#binding seems to still be there. I assume you'd have to avoid such assumptions once a proc's binding is accessed, directly or indirectly, and rollback prior optimizations that depend on those assumptions. Brian. On Tue, Jan 13, 2009 at 12:48, Charles Oliver Nutter wrote: > 1.8 can use a proc as a binding: > > $ ruby -e "x = 1; p = proc { }; eval 'puts x', p" > 1 > > I believe this was originally gone in 1.9, then added back. But it appears > to be gone again. > > $ ruby1.9 -e "x = 1; p = proc { }; eval 'puts x', p" > -e:1:in `eval': wrong argument type Proc (expected Binding) (TypeError) > from -e:1:in `
' > > Is this correct? I strongly believe Proc should not be usable as a binding, > since I believe it is a breach of trust: > > x = 1 > foo { puts 'hello' } > puts x # I can never trust the value of x!! > > - Charlie > >