[ruby-core:103005] [Ruby master Feature#17743] Show argument types in backtrace
From:
ufuk@...
Date:
2021-03-24 22:09:04 UTC
List:
ruby-core #103005
Issue #17743 has been updated by ufuk (Ufuk Kayserilioglu).
p8 (Petrik de Heus) wrote in #note-3:
> ```
> from hi.rb:2:in `say_hi' called with NilClass, Numeric, String
> ```
What about keyword arguments that could have been supplied in any order? What about the block argument, if it was `nil` or not?
> Maybe for Boolean values showing true and false.
There is no `Boolean` type in Ruby, so the output would naturally be `TrueClass` or `FalseClass` anyway. No need to special case this.
> I can imagine it being a performance overhead.
This is a huge drawback for a nice-to-have feature, though.
----------------------------------------
Feature #17743: Show argument types in backtrace
https://bugs.ruby-lang.org/issues/17743#change-91070
* Author: p8 (Petrik de Heus)
* Status: Open
* Priority: Normal
----------------------------------------
Given the following Ruby program:
``` ruby
def say_hi(person)
puts message(person)
end
def message(person)
"hi: #{person.name}"
end
say_hi(nil)
```
It would be helpful if the backtrace contained the types of the argumets:
```
hi.rb:6:in `message': undefined method `name' for nil:NilClass (NoMethodError)
from hi.rb:2:in `say_hi' called with NilClass
from hi.rb:9:in `<main>' called with NilClass
```
Inspired by the following Twitter thread: https://twitter.com/lzsthw/status/1374350046909628423
--
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>