From: Kent Dahl Date: 2001-03-18T07:40:01+09:00 Subject: [ruby-talk:12794] Explicitly giving block/proc binding? Seeing the threads on blocks and scope, I was wondering if there is any way to explicitly designate a binding when calling a block or proc? I've seen eval take a binding, but I can't seem to be able to change the binding of a proc. Since a proc has to remember the binding anyway, I'm curious as to wheter there is an easy way to change it afterwards? As far as I understood some bits in lecture at university about lambda calculus and such, blocks and Proc in Ruby are bound statically to the defining scope, while eval is dynamically bound, defaulting to the current binding. I'd like to be able to give a dynamic binding for the proc also, although right now I just want it like I want a big space rocket; pure power symbol, with no real clue what it could be useful for. Just curious... I'm fearing that such a thing might get too dangerous a weapon. I see methods doing nothing but creating alot of local variables in a binding, Proc's created for filling the binding variables with values and other Proc's for displaying and using the values... using bindings almost as datastorage... and woe us if we'd be allowed to change the current binding also. Ruby'd be so powerful, we'll be able to blow both legs and arms of ourselves. I hope that made some sense :-P -- <[ Kent Dahl ]>================<[ http://www.stud.ntnu.no/~kentda/ ]> )____(stud.techn.;ind..data)||(softwareDeveloper.at(Trustix))_( /"Opinions expressed are mine and not those of my Employer, "\ ( "the University, my girlfriend, stray cats, banana fruitflies, " ) \"nor the frontal lobe of my left cerebral hemisphere. "/