Project

General

Profile

Feature #16684

Updated by sawa (Tsuyoshi Sawada) over 4 years ago

The most-recent-call-last order of backtrace introduced by #8661: 

 ```ruby 
 def a; raise end 
 def b; a end 
 def c; b end 
 c 
 ``` 

 ``` 
 Traceback (most recent call last): 
	 3: from foo.rb:4:in `<main>' 
	 2: from foo.rb:3:in `c' 
	 1: from foo.rb:2:in `b' 
 foo.rb:1:in `a': unhandled exception 
 ``` 

 is intuitive, and I hope it is retained. However, there are people complaining that it is confusing. I believe the unnaturalness is (at least partly) due to the fact that the word "from" is used, which made sense when backtrace was displayed in most-recent-call-first order, 

 ``` 
 foo.rb:1:in `a': unhandled exception 
	 1: from foo.rb:2:in `b' 
	 2: from foo.rb:3:in `c' 
	 3: from foo.rb:4:in `<main>' 
 ``` 

 but not any more. Here, my understanding is that "from" means that the previous line was called **from** that line. 

 I propose that, so long as the most-recent-call-last order is adopted, the word "to" should be used rather than "from": 

 ``` 
 Traceback (most recent call last): 
	 3: to foo.rb:4:in `<main>' 
	 2: to foo.rb:3:in `c' 
	 1: to foo.rb:2:in `b' 
 foo.rb:1:in `a': unhandled exception 
 ``` 

 Or, as an alternative, if it looks unnatural to have "to" in the first line, and to lack one before the message line, we may put it at the end of a line: 

 ``` 
 Traceback (most recent call last) 
	 3: foo.rb:4:in `<main>' to: 
	 2: foo.rb:3:in `c' to: 
	 1: foo.rb:2:in `b' to: 
 foo.rb:1:in `a': unhandled exception 
 ``` 


 By using different words, it would become easier to understand the display order at a glance, and even by just looking at a single line.

Back