Calling Kernel#caller with a negative limit should limit result to N initial frames. When using Kernel#caller you often only want the first element of the result to get the information of the immediate caller. Generating the whole backtrace in this case is wasteful and time-consuming. Allowing Kernel#caller to take a negative limit to only return the first -N initial stack frames would allow for this.
I wouldn’t say “dup”, but it’s certainly related. This interface can be used instead of adding Kernel#called_from, if we want to keep the number of methods down. Also, even if we objectify the backtrace as per #1906 that still doesn’t mean that we shouldn’t have the limit as per this feature request.
Calling Kernel#caller with a negative limit should limit result to N initial frames. When using Kernel#caller you often only want the first element of the result to get the information of the immediate caller. Generating the whole backtrace in this case is wasteful and time-consuming. Allowing Kernel#caller to take a negative limit to only return the first -N initial stack frames would allow for this.