[Ruby 1.9-Feature#3917] [proposal] called_from() which is much faster than caller()

$B%A%1%C%H(B #3917 $B$,99?7$5$l$^$7$?!#(B (by Run Paint Run R.)

I can’t follow this discussion, but I’ll note proposal #1906 that also
aims to provide an alternative to #caller. (Oddly, I, too, hacked on
vm_backtrace_each(), and related functions, to try to implement the
aforementioned). I’d prefer a Hash/Struct to be returned, rather than an
Array, and favour #backtrace or #caller taking a count argument
rather than defining a new top-level method for such a narrow use.

Hi Run R., thank you for your comment about Kernel#caller.

2010/10/29 Run Paint Run R. [email protected]:

I can’t follow this discussion, but I’ll note proposal #1906 that
also aims to provide an alternative to #caller. (Oddly, I, too,
hacked on vm_backtrace_each(), and related functions, to try to
implement the aforementioned). I’d prefer a Hash/Struct to be
returned, rather than an Array, and favour #backtrace or #caller
taking a count argument rather than defining a new top-level method
for such a narrow use.

Ko1 has the same idea as what you proposed on #1906.
He want to change return value from “filename:linenum: in `name’”
to structured data type which is very similar to what you proposed.

And I already proposed to add new argument to Kernel#caller() in order
to
specify backtrace depth, instead of adding new top-level function.
Please check out ‘Another Solutions’ section on this ticket.

Ko1, could you read #1906 if you change return value of caller()?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs