From: Trans Date: 2005-09-07T03:36:28+09:00 Subject: Re: Change Binding of a Proc Pit Capitain wrote: > Trans schrieb: > > Thanks, I'l play with it some more. Actually I realized what you meant > > but I still had parameters to pass to the block -- and I don't see how > > I can get those in there -- perhaps wrapping a proc in a proc? > > > > Any which way I slice this it seems to be messy. > > Feel free to send me some more code samples, maybe even with unit tests > or another description of what you're trying to achieve. I can't promise > it, but if I have some free time I'll take a look. > > Regards, > Pit Thanks Pit that's really nice of you. But I broke down and just turned the procs into instance methods and had done with it. It works okay, even though it's not what I originally had in mind. I had want to soter those procs in a specal class, i.e. class MyMachine token :tag, proc {...}, proc {...} end When through def token( name, start, stop ) tokens << Token.new( name, start, stop ) end Later on I would have an instance of MyMachine, and I wanted to call on those procs _as if_ they were defined as methods within it. It just seems limiting that there'e no way to reassign the binding of a proc. Is it really that tricky under the hood? It must be feasible b/c I can define a method with a proc. So why isn't there an "invisible" way to attach a proc to the instance level of a class --as if one were defining a method, but not actually and then call on it elsewhere? Hmmm... I guess what I'm asking for is a #bind method for Proc. T.