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.
Bbc4b3fca1ae3161257a8636145b424d?d=identicon&s=25 Elliot Temple (Guest)
on 2006-05-09 07: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 Temple
http://www.curi.us/blog/
0ec4920185b657a03edf01fff96b4e9b?d=identicon&s=25 Yukihiro Matsumoto (Guest)
on 2006-05-09 07:58
(Received via mailing list)
Hi,

In message "Re: irb crash"
    on Tue, 9 May 2006 14:36:33 +0900, Elliot Temple <curi@curi.us>
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.