Hello,

At 20:27 20/05/2002 +0900, you wrote:
>Hi,
>
>At Mon, 20 May 2002 03:13:04 +0900,
>wconrad / yagni.com wrote:
> > There is an experimental patch at
> > http://yagni.com/stack_frames/index.php that lets you find out the
> > caller's class.  It's against Ruby 1.6.5; let me know if it won't
> > apply to whatever later version of Ruby you're using and I'll fix it
> > up.
>
>Interesting.  It's too hard to get an arbitrary binding, this
>is possible.
>
>I applied it to latest and modified:
>
>* renamed #class method to #klass since it is used to get
>   class,
>* #klass and #function return the Class itself and method ID
>   respectively, not name,
>* added optional argument for stack_frames to restrict depth
>   (and also to caller),
>
># and imagined about optional arguments for Enumerable#to_a...
>
>
>
>--
>Nobu Nakada

Having access to the binding would be nice too. Todays one needs to
track calls/returns in some set_trace_proc() in order to build a stack
frame that contains the bindings. That is pretty slow.
FYI: Thanks to bindings, one can introspect the value of local variables
in a stack frame. Can be useful when debugging for instance.

Yours,

Jean-Hugues


-------------------------------------------------------------------------
Web:  http://hdl.handle.net/1030.37/1.1
Phone: +33 (0) 4 92 27 74 17