From: me@... Date: 2019-07-14T21:41:44+00:00 Subject: [ruby-core:93765] [Ruby master Feature#16001] Provide an alias to Kernel#caller_locations(1, 1) and Kernel#caller(1, 1) Issue #16001 has been updated by piotrmurach (Piotr Murach). > it's not an alias for brevity Definitely not brevity but clarity certainly. The `caller(1,1)` seems cryptic as compared to `direct_caller` which is more expressive. > it's a performance thing. Getting the full backtrace is extremely expensive and nobody has a good idea how to make it fully lazy. This new method allows the user to explicitly say that they only need some of the callers. That's a very important point. Limiting the full backtrace to the immediate caller will reduce unnecessary allocations. ---------------------------------------- Feature #16001: Provide an alias to Kernel#caller_locations(1,1) and Kernel#caller(1,1) https://bugs.ruby-lang.org/issues/16001#change-79406 * 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 an alias to help get the previous backtrace frame and avoid common beginner mistakes getting full backtrace information. The currently suggestions are: * `immediate_caller` * `caller_first` * `caller_only` This feature request is based on 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: