On Tue, Oct 25, 2011 at 3:51 PM, Rocky Bernstein <rockyb / rubyforge.org> wrote:
> One could also say the same thing with eval'ing strings, but I doubt that
> folks have considered removing that.

No, one could not. This is a completely different situation.

eval of a string with no specified binding operates within the current
scope...i.e. the scope you own. eval of a string against a specific
Binding object means someone, somewhere has explicitly called
Kernel#binding with full knowledge of what they are exposing.

> Does anyone have statistics on how often binding is used and what the costs
> is for not optimizing those portions?
>
> Binding in Ruby is used by debuggers or other dynamic introspection tools to
> give access to call stack objects. There are dynamic languages such as Perl
> and some of the POSIX shells (bash and zsh but not more recent ksh) that
> don't have something like binding; therefore debuggers in those languages
> can't provide reliable info regarding certain variables on the call stack
> other than the top-most frame.
>
> Does it matter? Some probably would argue it doesn't. I think access to
> locals on the call stack in a debugger is nice to have.

That is neither here nor there. I am not proposing removing bindings.

What I am proposing is removal of the ability to use an arbitrary Proc
as a binding. Right now, millions of Ruby developers are passing
blocks around, blissfully unaware that they are exposing *all* state
that surrounds the block to the called code. Please read my example
again.

- Charlie