Issue #16001 has been updated by shevegen (Robert A. Heiler).


> For some reason nobody seems to have commented here what I think is the original motivation for this
> new method - it's not an alias for brevity, it's a performance thing. 

I think this may have been lost a bit in the discussion because typically aliases are used to use something
differentially, such as .map versus .collect. At first I also thought that there is something about an
exciting new feature :-) until I noticed that the primary use case may have been related to
speed/performance gains; which is nice (as matz has said: nobody minds if things become faster), but I
was almost hoping for something cool, new and extremely exciting! :D

To the name itself, from the suggestions, I like benoit's direct_caller the most (from the above), 
for caller_locations(1,1) - but it may be best to have someone from the core team comment on the
proposal thus far in regards to the speed/performance improvement here.

----------------------------------------
Feature #16001: Provide an alias to Kernel#caller_locations(1,1) and Kernel#caller(1,1)
https://bugs.ruby-lang.org/issues/16001#change-79408

* Author: piotrmurach (Piotr Murach)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
As it is common to use `caller_locations(1,1)` and `caller(1,1)`, this proposes aliases to help get the previous backtrace frame and improve performance by avoiding getting full backtrace information.

The currently suggestions are:
* `immediate_caller`
* `first_caller`
* `caller_only`

This feature request is based on a conversation with Charles Nutter who says:
> This is such a common thing... maybe we need to add something like #caller_only or #caller1 that basically do caller(1,1).



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>