E
Eric Mahurin
This is mostly a curiosity thing...
Is there a way to unbind a Proc from the binding it was created
in? What I mean by this is taking a Proc and looking
up/calling everything it refers to outside of itself and
replacing them with what was found - objects. Assignments to
the outside and method calls that modify things on the outside
should be considered illegal.
The application for doing this would be to get rid of many
*eval(string) calls which I think are evil because you are
parsing/recompiling code at run-time - a severe limitation to
optimization. I think many of the times that you use
*eval(string) instead of *eval(proc) (or Proc#call), you do so
because you take the values of certain variables and put it in
the string (with #{...}). You want these to be constant
instead of refer to these variables in your context all the
time. This effectively "unbinds" those variables from their
context.
Another useful thing might be rebinding a Proc to a different
Binding. But, I can't think of any applications off-hand.
__________________________________
Discover Yahoo!
Find restaurants, movies, travel and more fun for the weekend. Check it out!
http://discover.yahoo.com/weekend.html
Is there a way to unbind a Proc from the binding it was created
in? What I mean by this is taking a Proc and looking
up/calling everything it refers to outside of itself and
replacing them with what was found - objects. Assignments to
the outside and method calls that modify things on the outside
should be considered illegal.
The application for doing this would be to get rid of many
*eval(string) calls which I think are evil because you are
parsing/recompiling code at run-time - a severe limitation to
optimization. I think many of the times that you use
*eval(string) instead of *eval(proc) (or Proc#call), you do so
because you take the values of certain variables and put it in
the string (with #{...}). You want these to be constant
instead of refer to these variables in your context all the
time. This effectively "unbinds" those variables from their
context.
Another useful thing might be rebinding a Proc to a different
Binding. But, I can't think of any applications off-hand.
__________________________________
Discover Yahoo!
Find restaurants, movies, travel and more fun for the weekend. Check it out!
http://discover.yahoo.com/weekend.html