From: Paul Brannan Date: 2004-07-06T12:43:38+09:00 Subject: Re: tracing variables On Tue, Jul 06, 2004 at 12:57:39AM +0900, gabriele renzi wrote: > Hi gurus and nubys, > > I wonder: is there a way in ruby to trace assignments to variables? I don't know of any way, but I think it would be a nice feature to have. The debugger supports watchpoints, but afaict they seem to only break when an expression becomes true. It shouldn't be difficult (though it would be slow) to use set_trace_func to determine when the value of an expression/variable changes, but there's no easy way to detect "a = a". If you want to use this in a real program and not just for debugging, then you might want to consider using the observer pattern (see observer.rb). Paul