Issue #7435 has been updated by headius (Charles Nutter).


I wish I had seen this before 2.0.0!

Perhaps set_backtrace should just cause backtrace_locations to return an empty array?

I really, really wish backtrace_locations had gotten into 2.0.0, so let's try to make this happen for 2.1.
----------------------------------------
Feature #7435: Exceptions should have backtrace_locations
https://bugs.ruby-lang.org/issues/7435#change-36685

Author: sam.saffron (Sam Saffron)
Status: Rejected
Priority: Normal
Assignee: ko1 (Koichi Sasada)
Category: core
Target version: next minor


Further to http://bugs.ruby-lang.org/issues/7051 

def boom
  raise "boom"
end

begin
  boom
rescue => e
  p e.backtrace
end

# ["t.rb:2:in `boom'", "t.rb:6:in `<main>'"]

It seems exceptions still store backtraces in strings, shouldn't the backtrace be stored in RubyVM::Backtrace::Location objects and then optionally grabbed using backtrace_locations or backtrace depending on how you feel? 

This means exceptions could be more efficient as filenames could easily be pinned in memory leading to significantly reduced allocation for exceptions. 


-- 
http://bugs.ruby-lang.org/