Issue #8661 has been updated by shevegen (Robert A. Heiler).


I think I agree with mame - perhaps it should be reverted for now.

There was another ruby hacker from japan who wrote, some time ago
(a year or two?), that he was confused about it too; I don't remember
where it was but I think it was in a standalone proposal some time
ago.

In my opinion, the best would be to find a way to be able to 
fully customize the behaviour/display that ruby uses for reporting 
warnings/errors, with a default chosen that may be most appropriate
for the most common ways to display the issues at hand (I have no
preference to the default chosen here, but perhaps we should 
revert to the behaviour ruby used to use; and then allow full
customization for people to adapt it to their own personal needs).

I assume that matz may not have a huge preference either, so 
perhaps we should (lateron?) focus on some way to be able to
customize how ruby treats warnings/errors or rather, display
them. An obvious way may be to allow for environment variables.

An additional way may be to pick something at compile time (so
that people can customize it for their own host system, as a 
default), and perhaps also a --user flag directive of some
sorts; and perhaps additionally something like $VERBOSE, but
through some core method call or something instead.

I should, however had, also note that while I think I prefer
the old behaviour, to me personally it is not a huge deal either
way - I just can understand everyone who may not like the
chosen default as-is. The only thing that I personally found hard
was when the filenames are very long and the error is somewhere
deep down in code that gets called by lots of other methods in
different files - then the error messages are "overflowing" to
the right of my screen display, so in this case, I would prefer
a shorter message, or perhaps split up onto several lines; I kind
of focus on the left hand side of my screen normally. But again,
it's not really something I personally am deeply invested - I am
personally am more looking as to how mjit is progressing. :)

----------------------------------------
Feature #8661: Add option to print backstrace in reverse order(stack frames first & error last)
https://bugs.ruby-lang.org/issues/8661#change-73606

* Author: gary4gar (Gaurish Sharma)
* Status: Closed
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version: 
----------------------------------------
Currently the way ruby prints the backtrace is that the error comes first & then the stack frames. like this

```
  Main Error Message
stack frame 1
stack frame 2
stack frame 3
.....
```

 this is perfectly fine provided

1. Backstraces are short, so fits in terminal.hence, no need to scroll.
2. you read it from top to bottom.


But, I am a rails developer where 

1. Backstraces are always HUGE, therefore seldom don't fit in terminal. Means LOTS of scrolling to do everytime we get an error.
2. in terminal we tend to read backstraces from bottom to top, especially when tailing(tail -f) the production logs. 
3. people, who practice Test-driven development literally spend most of their time scrolling to read backstraces to the point most end up buying a larger display.

Proposed Solution:
 Please add a way so we can configure backstraces to be printed in reverse order. so if you are reading from bottom, say from terminal, you can get the main error message without need to scroll. like this


```
stack frame 3
stack frame 2
stack frame 1
 Main Error Message
..... 
```

this would save lot of time because when the error message is print at the bottom, no need to scroll for reading it. Not sure if this can be done today. I tried Overriding Exception#backtrace but it caused stack level too deep & illegal hardware instruction Error.

Attached are currently what backstrace currently looks like & how there be an option to make it look for comparison.

---Files--------------------------------
current.log (5.13 KB)
proposed.log (4.9 KB)


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