From: "Mauricio Fernández" Date: 2005-09-19T19:11:03+09:00 Subject: Re: Reference to 'this block' On Mon, Sep 19, 2005 at 06:23:23PM +0900, Brian Candler wrote: > I want the object to be self-contained. 'self' doesn't work. Best I can come > up with is to try and hide it: > > a = __myfoo = lambda { |x| x < 2 ? 1 : x * __myfoo.call(x-1) } You can use the Y combinator or something as simple as # make sure _l is block-local a = lambda{ _l = lambda{|x| x < 2 ? 1 : x * _l[x-1]}}[] p a[5] _l = 1 # doesn't matter p a[5] -- Mauricio Fernandez