Hi--

On 4/29/05, Emiel van de Laar <emiel / il.fontys.nl> wrote:
> Hi list,
> 
> I've just read a post on Peter Williams' blog about his annoyance
> with the current ruby backtraces. Basically he is asking for
> argument information in the backtrace.
> 
> See the full post here:
> 
> http://pezra.barelyenough.org/blog/2005/04/ruby-backtraces/
> 
> Contrary to Peter's suggestion, I'd like to see the arguments class
> instead of the value, i.e. "peter".
> 
> I'm curious what ruby-core thinks about this and if it is doable.
> Seems like a worthy effort to me.

I would go even further and propose that a more OOP approach be taken.
The BackTrace should be an object itself, basically an array of
TracePoints and a TracePoint is itself essentially a Binding. Then a
BackTrace object would be the return value of #caller (or an alternate
method, say #class_stack). The BackTrace would have a method like #pp
to output the pretty print we normally see (but, I agree, with args
info added) and this is what would be shown on an error.

I have partly implemented this already in pure-Ruby, but it really
needs to be core to be efficient and complete.

(Note the TracePoints being actual Bindings may be overkill. I don't
have enough under-the-hood knowledge to know if it would be too
inefficient or not, but in either case a lighter weight object could
be used in its stay.)

T.