Irb crash


#1

I’m new so I don’t know if/where I should report this…

if I type:

String = Hash

in irb twice it crashes. it crashed with other stuff besides Hash,
too. just doing it twice at once with a semicolon doesn’t crash
immediately.

OS X 10.4.6
ruby 1.8.4 (2005-12-24) [powerpc-darwin8.5.0]
irb 0.9.5(05/04/13)

curi-g5:~ curi$ irb
irb(main):001:0> String = Hash
(irb):1: warning: already initialized constant String
=> Hash
irb(main):002:0> String = Hash
/usr/local/lib/ruby/1.8/irb/ruby-token.rb:101:in Token': undefined methodancestors’ for “=”:String (NoMethodError)
from /usr/local/lib/ruby/1.8/irb/ruby-lex.rb:400:in lex_init' from /usr/local/lib/ruby/1.8/irb/slex.rb:237:inmatch_io’
from /usr/local/lib/ruby/1.8/irb/slex.rb:222:in match_io' from /usr/local/lib/ruby/1.8/irb/slex.rb:76:inmatch’
from /usr/local/lib/ruby/1.8/irb/ruby-lex.rb:287:in token' from /usr/local/lib/ruby/1.8/irb/ruby-lex.rb:263:inlex’
from /usr/local/lib/ruby/1.8/irb/ruby-lex.rb:234:in
each_top_level_statement' from /usr/local/lib/ruby/1.8/irb/ruby-lex.rb:230:ineach_top_level_statement’
from /usr/local/lib/ruby/1.8/irb/ruby-lex.rb:229:in
each_top_level_statement' from /usr/local/lib/ruby/1.8/irb.rb:146:ineval_input’
from /usr/local/lib/ruby/1.8/irb.rb:70:in start' from /usr/local/lib/ruby/1.8/irb.rb:69:instart’
from /usr/local/bin/irb:13
curi-g5:~ curi$

– Elliot T.


#2

Hi,

In message “Re: irb crash”
on Tue, 9 May 2006 14:36:33 +0900, Elliot T. removed_email_address@domain.invalid
writes:

|I’m new so I don’t know if/where I should report this…
|
|if I type:
|
|String = Hash
|
|in irb twice it crashes. it crashed with other stuff besides Hash,
|too. just doing it twice at once with a semicolon doesn’t crash
|immediately.

Re-assigning predefined class like String should cause serious
problems such as you’ve seen. Ruby allows you to shoot your foot.

						matz.