Forum: Ruby irb crash

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Elliot T. (Guest)
on 2006-05-09 09:39
(Received via mailing list)
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
method `ancestors' 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:in `match_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:in `match'
         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:in `lex'
         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:in
`each_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:in `eval_input'
         from /usr/local/lib/ruby/1.8/irb.rb:70:in `start'
         from /usr/local/lib/ruby/1.8/irb.rb:69:in `start'
         from /usr/local/bin/irb:13
curi-g5:~ curi$

-- Elliot T.
http://www.curi.us/blog/
Yukihiro M. (Guest)
on 2006-05-09 09:58
(Received via mailing list)
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.
This topic is locked and can not be replied to.