From: "Mauricio Fernández" Date: 2004-08-18T09:06:32+09:00 Subject: Re: Getting the binding of the caller On Wed, Aug 18, 2004 at 07:52:18AM +0900, Michael Neumann wrote: > Hi, > > Is there a way to get the binding of the caller? > > class A > def m(b=binding) > eval("self", b) > end > end > > A.new.m # => # > A.new.m(binding) # => main > > What I want is exactly the second, but without specifying "binding" > explicitly. > > Possible or not? Sure. Take a look at Florian Gro�' Binding.of_caller at http://noegnud.sourceforge.net/flgr/binding_of_caller.rb In some contexts, you can avoid the overhead of #callcc, but you get an ugly interface in exchange. -- Running Debian GNU/Linux Sid (unstable) batsman dot geo at yahoo dot com