From: SASADA Koichi Date: 2012-11-27T08:36:42+09:00 Subject: [ruby-core:50185] Re: [ruby-trunk - Feature #7434] Allow caller_locations and backtrace_locations to receive negative params (2012/11/27 7:35), sam.saffron (Sam Saffron) wrote: > This means that there are 60 or so frames below my application. If I just want to gather a trace for my application code, I really want: > > caller_locations(0, -60) ... I work around by doing caller_locations[0..-60] however the VM is going to do tons of work to grab all these objects just for me to discard them. I know that Rails (and framework) has big backtrace array. My question is: use-case of negative number for performance. Your answer only shows "backtrace is big". By the way, current implementation grabs *all* of backtrace information and cuts `n'th elements from `level' (`n' is 2nd argument and `level' is 1st argument). This is implementation limitation. We need to seek all of backtrace to make correct backtrace. If you want to know "why it is needed?", please read source code. Short answer is "There are some frames which does not have location information". -- // SASADA Koichi at atdot dot net