From: "sam.saffron (Sam Saffron)" Date: 2012-11-27T18:35:27+09:00 Subject: [ruby-core:50214] [ruby-trunk - Feature #7434] Allow caller_locations and backtrace_locations to receive negative params Issue #7434 has been updated by sam.saffron (Sam Saffron). > The last point is API design. > "negative number" to this purpose is feasible? I like negative numbers cause it has some parity with the range APIs, eg: [1,2,3][0..-2] # skip last > Any other example for other methods? I can not think of a use case for for the first param being negative, even though for arrays [1,2,3](-2..-1) makes sense, I can not think of a case where one would do caller_locations(-10, -1), the proposal is all about making the second param more flexible. ---------------------------------------- Feature #7434: Allow caller_locations and backtrace_locations to receive negative params https://bugs.ruby-lang.org/issues/7434#change-34022 Author: sam.saffron (Sam Saffron) Status: Assigned Priority: Normal Assignee: ko1 (Koichi Sasada) Category: core Target version: next minor Further to http://bugs.ruby-lang.org/issues/7051 It would be nice if caller_locations and backtrace_locations has some parity with range apis. pry(main)> [1,2,3][0..-2] => [1, 2] Similarly: caller_locations(0,-2) # should strip the bottom frame This is actually quite important for diagnostics of Rails and other frameworks where the app code starts at a very deep frame. At the moment you are forced to materialize all frames just to discard. -- http://bugs.ruby-lang.org/