Robert Klemme
4/3/2007 4:06:00 PM
On 03.04.2007 17:38, Tomasz Wegrzanowski wrote:
> Hello, I found that set_trace_func is behaving in a weird way,
> missing some call events.
That's probably because the call was never done. You probably ran into
the difference between
ruby -e 'def foo(a,b) end; set_trace_func lambda {|*a| p a}; foo 1'
and
ruby -e 'def foo() raise ArgumentError end; set_trace_func lambda {|*a|
p a}; foo 1'
In the first case the interpreter detects the argument error but in the
second case the method does it by itself. Typically you will see
something like
def foo(*a)
raise ArgumentError unless a.size > 3
# ...
end
> Calls with bad number of arguments to other functions like Array#[]
> work correctly.
That may be because Array#[] accepts different numbers of arguments and
does the argument processing by itself.
I am not sure what you are actually trying to achieve. Can you elaborate?
Regards
robert