Wednesday, 16 June 2010

My daily newspaper

Thursday, 3 June 2010

Lost in metaprogramming

More often than not, making heavy use of meta-programming, will get you into trouble. Especially when nasty side effects kick in and exceptions raise when they shouldn't. Clearly, analysis of the stack trace is rather pointless.

Then, sometimes, defining set_trace_func comes handy:

set_trace_func lambda { |event, file, line, id, binding, classname|
puts "=" * 40
puts "%8s :%-2d %5s %8s" % [event, line, id, classname]

another interesting gem for this purpose is Unroller