irb issue

Discussion in 'Ruby' started by Luís Miguel Lourenço, Dec 29, 2004.

  1. 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
    Luís Miguel Lourenço, Dec 29, 2004
    #1
    1. Advertising

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


    Luís Miguel Lourenço <> 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/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--
    Lorenzo Jorquera, Dec 29, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Sam Stephenson
    Replies:
    1
    Views:
    213
    Andrew Walrond
    Jun 18, 2005
  2. gga
    Replies:
    0
    Views:
    98
  3. Replies:
    1
    Views:
    149
    Florian Groß
    Oct 26, 2005
  4. Jason Wold

    wierd cut and paste issue with irb

    Jason Wold, Jan 20, 2006, in forum: Ruby
    Replies:
    2
    Views:
    138
    Michael Ulm
    Jan 20, 2006
  5. anne001
    Replies:
    1
    Views:
    255
    anne001
    Jun 27, 2006
Loading...

Share This Page