[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

irb issue

Luís Miguel Lourenço

12/29/2004 8:37:00 PM

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... 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



1 Answer

Lorenzo Jorquera

12/29/2004 8:52:00 PM

0

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.


Luís Miguel Lourenço <lmlourenco@ieee.org> wrote:
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... 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.