From: Robert Klemme Date: 2005-08-19T19:56:17+09:00 Subject: Re: finding one's self in the strangest places Trans wrote: > What amazes me about this is that 'name' in 'name[self]' is a local > variable assigned to a lambda, yet 'self' is not and rather belongs to > the initialized instance of the class. How is that possible? How is > execution of the lambda deferred til later? I think this is a > facinating example of Ruby's "juggling" abilities. The concept is generally known as "closure". The closure captures variable bindings so you can access them later: 12:53:16 [source]: ruby -e 'x=10;f=lambda { x }; p f.call;x=20;p f.call' 10 20 12:53:23 [source]: > Also, it would be nice to be able to take this one step further, if it > were possible NOT to have to explictly pass 'binding' via > #dyanmic_mixin or pass 'self' via the local var lambda, then it would > be perfect. There is a module that allows access to the bindinf of the caller. This would help you as it would make passing a binding explicit unnecessary. Kind regards robert