[ruby-core:94026] [Ruby master Feature#16001] Provide an alias to Kernel#caller_locations(1, 1) and Kernel#caller(1, 1)
From:
ko1@...
Date:
2019-07-30 07:26:28 UTC
List:
ruby-core #94026
Issue #16001 has been updated by ko1 (Koichi Sasada). * maybe it should be an alias of `caller_locations(1, 1).first`. * do you know good name on it? `caller_location(n=1)`, for example? * do people use it on performance important places? I assume it is debugging method. Other than debugging, I think it should be a bad idea because depending on (direct) caller disallows delegation, druby and other techniques. ---------------------------------------- Feature #16001: Provide an alias to Kernel#caller_locations(1,1) and Kernel#caller(1,1) https://bugs.ruby-lang.org/issues/16001#change-80251 * 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 - a common mistake. 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>