[#3726] Fixnum#clone and Float#clone raise different exceptions — "David A. Black" <dblack@...>

Hi --

15 messages 2004/11/12
[#3749] Re: Fixnum#clone and Float#clone raise different exceptions — "David A. Black" <dblack@...> 2004/11/16

Hi --

[#3751] Re: Fixnum#clone and Float#clone raise different exceptions — Yukihiro Matsumoto <matz@...> 2004/11/16

Hi,

[#3752] Re: Fixnum#clone and Float#clone raise different exceptions — "David A. Black" <dblack@...> 2004/11/16

Hi --

[#3785] The latest 1.8.2 cvs prints parse error when starting extension compiling — Yukihiro Matsumoto <matz@...>

Hi,

13 messages 2004/11/23
[#3787] Re: The latest 1.8.2 cvs prints parse error when starting extension compiling — Johan Holmberg <holmberg@...> 2004/11/23

Re: RFE: Kernel#set_trace_func

From: Paul Brannan <pbrannan@...>
Date: 2004-11-29 15:10:17 UTC
List: ruby-core #3854
On Sun, Nov 28, 2004 at 08:26:06AM +0900, Florian Growrote:
> Moin!
> 
> Would it be possible to let set_trace_func() return the trace func that 
> was set before the current one gets stored? This would be very useful 
> when you have a temporary trace func that will go away quickly. I'd find 
> this particularly useful for letting Binding.of_caller and Tracer 
> coexist peacefully, but I'm pretty sure there are a lot more use cases.

This would introduce an incompatibility.  set_trace_func currently
returns the new trace func; I don't know if anyone relies on this
behavior (seems unlikely, but possible).

The problem is more general than your case; any time you want multiple
trace funcs (e.g. running the profiler and tracer together), it's useful
to get the old trace func.  This is why I proposed the trace_func
accessor in RCR#196; it doesn't have the incompatibility mentioned
above, but still allows multiple trace_funcs.

Matz's complaint, though, was that chaining is ugly (and I agree; how do
you remove a trace func from the middle of the chain?).  Another
solution is to have set_trace_func return an id that can be used to
later remove the trace func via a call to remove_trace_func.  It's
possible to implement this entirely in ruby, if you really need it.
This still breaks backward-compatibility, though.

I like the idea some anonymous RCR user suggested of having a
well-defined API for all of ruby's hooks.  I don't know what this API
would look like, though, or I would suggest it.

Paul


In This Thread

Prev Next