Issue #16684 has been updated by matz (Yukihiro Matsumoto).


I don't think `to` is sufficient. I'd rather remove `from` altogether if there's no compatibility issue.
Should we remove them?

Matz.


----------------------------------------
Feature #16684: Use the word "to" instead of "from" in backtrace
https://bugs.ruby-lang.org/issues/16684#change-84999

* Author: sawa (Tsuyoshi Sawada)
* Status: Open
* Priority: Normal
----------------------------------------
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
```

**Current**

```
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 to me, 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", which would mean that the previous line leads **to** that line:

**Proposed 1**

```
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:

**Proposed 2**

```
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.



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

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>