Feature #2018
closed[irb] BasicObject.new doesn't have an inspect
Description
=begin
Using BasicObject.new in irb:
daniel@boviAir# ruby19 --version
ruby 1.9.2dev (2009-08-30 trunk 24718) [i386-darwin9.8.0]
daniel@boviAir# irb19 --version
irb 0.9.6(09/06/30)
daniel@boviAir# irb19
irb(main):001:0> BasicObject.new
Produce an Exception due to the fact that inspect doesn't exist in the BasicObject:
NoMethodError: undefined method inspect' for #<BasicObject:0x4b2738> from /Users/danielbovensiepen/Programs/ruby19/lib/ruby/1.9.1/irb/inspector.rb:84:in
block in module:IRB'
from /Users/danielbovensiepen/Programs/ruby19/lib/ruby/1.9.1/irb/inspector.rb:30:in call' from /Users/danielbovensiepen/Programs/ruby19/lib/ruby/1.9.1/irb/inspector.rb:30:in
inspect_value'
from /Users/danielbovensiepen/Programs/ruby19/lib/ruby/1.9.1/irb/context.rb:259:in inspect_last_value' from /Users/danielbovensiepen/Programs/ruby19/lib/ruby/1.9.1/irb.rb:309:in
output_value'
from /Users/danielbovensiepen/Programs/ruby19/lib/ruby/1.9.1/irb.rb:158:in block (2 levels) in eval_input' from /Users/danielbovensiepen/Programs/ruby19/lib/ruby/1.9.1/irb.rb:271:in
signal_status'
from /Users/danielbovensiepen/Programs/ruby19/lib/ruby/1.9.1/irb.rb:154:in block in eval_input' from /Users/danielbovensiepen/Programs/ruby19/lib/ruby/1.9.1/irb/ruby-lex.rb:244:in
block (2 levels) in each_top_level_statement'
from /Users/danielbovensiepen/Programs/ruby19/lib/ruby/1.9.1/irb/ruby-lex.rb:230:in loop' from /Users/danielbovensiepen/Programs/ruby19/lib/ruby/1.9.1/irb/ruby-lex.rb:230:in
block in each_top_level_statement'
from /Users/danielbovensiepen/Programs/ruby19/lib/ruby/1.9.1/irb/ruby-lex.rb:229:in catch' from /Users/danielbovensiepen/Programs/ruby19/lib/ruby/1.9.1/irb/ruby-lex.rb:229:in
each_top_level_statement'
from /Users/danielbovensiepen/Programs/ruby19/lib/ruby/1.9.1/irb.rb:153:in eval_input' from /Users/danielbovensiepen/Programs/ruby19/lib/ruby/1.9.1/irb.rb:70:in
block in start'
from /Users/danielbovensiepen/Programs/ruby19/lib/ruby/1.9.1/irb.rb:69:in catch' from /Users/danielbovensiepen/Programs/ruby19/lib/ruby/1.9.1/irb.rb:69:in
start'
from /Users/danielbovensiepen/Programs/ruby19/bin/irb19:12:in `'Maybe IRB bug!!
In the attachment is a patch for catching this exception.
=end
Files
Updated by dblack (David Black) over 15 years ago
=begin
Hi --
On Mon, 31 Aug 2009, Daniel Bovensiepen wrote:
Bug #2018: [irb] BasicObject.new doesn't have an inspect
http://redmine.ruby-lang.org/issues/show/2018
Why is that a bug?
David
--
David A. Black / Ruby Power and Light, LLC / http://www.rubypal.com
Ruby/Rails training, mentoring, consulting, code-review
Latest book: The Well-Grounded Rubyist (http://www.manning.com/black2)
September Ruby training in NJ has been POSTPONED. Details to follow.
=end
Updated by hongli (Hongli Lai) over 15 years ago
=begin
I thought the whole point of BasicObject is that it doesn't have any methods.
=end
Updated by matz (Yukihiro Matsumoto) over 15 years ago
=begin
Hi,
In message "Re: [ruby-core:25201] Re: [Bug #2018] [irb] BasicObject.new doesn't have an inspect"
on Mon, 31 Aug 2009 02:49:19 +0900, "David A. Black" dblack@rubypal.com writes:
|> Bug #2018: [irb] BasicObject.new doesn't have an inspect
|> http://redmine.ruby-lang.org/issues/show/2018
|
|Why is that a bug?
I think it's not the point. BasicObject has no method (with a few
exception) by its definition. But irb should handle objects without
inspect defined.
matz.
=end
Updated by dblack (David Black) over 15 years ago
=begin
On Mon, 31 Aug 2009, Yukihiro Matsumoto wrote:
Hi,
In message "Re: [ruby-core:25201] Re: [Bug #2018] [irb] BasicObject.new doesn't have an inspect"
on Mon, 31 Aug 2009 02:49:19 +0900, "David A. Black" dblack@rubypal.com writes:|> Bug #2018: [irb] BasicObject.new doesn't have an inspect
|> http://redmine.ruby-lang.org/issues/show/2018
|
|Why is that a bug?I think it's not the point. BasicObject has no method (with a few
exception) by its definition. But irb should handle objects without
inspect defined.
Ah, OK -- I didn't catch onto that.
Actually I really like doing:
>> b = BasicObject.new
in irb when I'm teaching 1.9 -- very dramatic way to demonstrate the
basicness of BasicObject :-) But I can understand that it should
probably be handled more gracefully.
David
--
David A. Black / Ruby Power and Light, LLC / http://www.rubypal.com
Ruby/Rails training, mentoring, consulting, code-review
Latest book: The Well-Grounded Rubyist (http://www.manning.com/black2)
September Ruby training in NJ has been POSTPONED. Details to follow.
=end
Updated by yugui (Yuki Sonoda) over 15 years ago
- Assignee set to keiju (Keiju Ishitsuka)
- Target version set to 2.0.0
=begin
It is not a bug. But I think enhancement for irb is possible.
What kind of handling do you want?
=end
Updated by matz (Yukihiro Matsumoto) over 15 years ago
- Status changed from Open to Closed
- % Done changed from 0 to 100
=begin
Applied in changeset r24779.
=end