irb issue

  • Thread starter Luís Miguel Lourenço
  • Start date
L

Luís Miguel Lourenço

Hello,

I'm not sure if this is a bug but I've stumbled across some strange
behaviour in irb. I've tried looking at
http://www.ruby-lang.org/cgi-bin/ruby-bugs but I get a 404.

If I do something like "String = 2" two times in a row in irb it
crashes:
[lml@null:~/Documents/Code/ruby/mm/code] irb
irb(main):001:0> String = 2
(irb):1: warning: already initialized constant String
=> 2
irb(main):002:0> String = 2
/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:390:in `lex_init'
...

[lml@null:~/Documents/Code/ruby/mm/code] irb --version
irb 0.9(02/07/03)
[lml@null:~/Documents/Code/ruby/mm/code] ruby --version
ruby 1.8.2 (2004-11-03) [powerpc-darwin7.5.0]

Luís Miguel Lourenço
 
L

Lorenzo Jorquera

--0-1638950864-1104353540=:86087
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit

Hi Luis

Be aware that in your first assignement (String = 2) you are destroying the String class, and after that you can´t create more strings via String.new (if you try writing String.new after String = 2 you will get the same error).
I guess the irb parser is crashing because it is trying to create a string.


Hello,

I'm not sure if this is a bug but I've stumbled across some strange
behaviour in irb. I've tried looking at
http://www.ruby-lang.org/cgi-bin/ruby-bugs but I get a 404.

If I do something like "String = 2" two times in a row in irb it
crashes:
[lml@null:~/Documents/Code/ruby/mm/code] irb
irb(main):001:0> String = 2
(irb):1: warning: already initialized constant String
=> 2
irb(main):002:0> String = 2
/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:390:in `lex_init'
...

[lml@null:~/Documents/Code/ruby/mm/code] irb --version
irb 0.9(02/07/03)
[lml@null:~/Documents/Code/ruby/mm/code] ruby --version
ruby 1.8.2 (2004-11-03) [powerpc-darwin7.5.0]

Luís Miguel Lourenço




---------------------------------
Do You Yahoo!?
Todo lo que quieres saber de Estados Unidos, América Latina y el resto del Mundo.
Visíta Yahoo! Noticias.

--0-1638950864-1104353540=:86087--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top