(2013/02/21 6:02), headius (Charles Nutter) wrote:
>  I propose that if you set_backtrace, you are already breaking the ability to get structured Location elements, so set_backtrace should cause backtrace_locations to return nil or an empty array (probably an empty array, so it can always be expected to be non-nil).
> 
> We could consider also adding set_backtrace_locations as a way to set Location elements into the exception.

I want to agree with you. But I feel there are worries.

(a) Exception#set_backtrace are used by frameworks

Maybe Exception#set_backtrace are used by frameworks such as Rails. So
that your proposal "if Exception#set_backtrace was called, disable
Exception#backtrace_locations" seems bad idea because 99% of people
works on Rails (*1) and 99% (*1) of people can't use
Exception#backtrace_locations.

*1: joking.

(b) We can't use Exception#backtrace_locations in library

If you write a library using Exception#backtrace_locations, this library
can't use with this library with programs using Exception#set_backtrace.
As I pointed out by (a), we can't mix with frameworks.

----

Other options:

(1) Make Exception#set_backtrace parse each backtrace lines.
    Problem:
    (1-p1) Parsing is difficult. Path format is OS dependent.
    (1-p2) How to parse not well-formed line?

(2) Deprecate set_backtrace and replace it with set_backtrace_locations
    Problem:
    (2-p1) Compatibility!!!


(1) with heuristics parsing technique is pragmatic?

-- 
// SASADA Koichi at atdot dot net