Strange IRB Syntax Error

Discussion in 'Ruby' started by Robert Klemme, Jun 27, 2003.

  1. Hi,

    while playing around a bit I encountered this:

    irb(main):001:0> RUBY_VERSION
    "1.7.3"
    irb(main):002:0> class Trivial
    irb(main):003:1> def initialize(n)
    irb(main):004:2> @n = n
    irb(main):005:2> end
    irb(main):006:1>
    irb(main):007:1* def n
    irb(main):008:2> @n
    irb(main):009:2> end
    irb(main):010:1>
    irb(main):011:1* def == (anOther)
    irb(main):012:1> @n == anOther.n
    irb(main):013:1> end
    SyntaxError: compile error
    (irb):13: syntax error
    from (irb):13
    irb(main):014:0>
    irb(main):015:0* def <=>(anOther)
    irb(main):016:1> @n <=> anOther.n
    irb(main):017:1> end
    nil
    irb(main):018:0>
    irb(main):019:0* def eql?(o); self == o; end
    nil
    irb(main):020:0> end
    SyntaxError: compile error
    (irb):20: syntax error
    from (irb):20
    irb(main):021:0>

    Strangely when parsed from a file there's no error. Why is that so? Does
    it have to do with the specific way IRB parses inputs or is it a bug?

    Regards

    robert
     
    Robert Klemme, Jun 27, 2003
    #1
    1. Advertisements

  2. Robert Klemme

    nobu.nokada Guest

    Hi,

    At Fri, 27 Jun 2003 17:03:11 +0900,
    It's too old, and fixed already.

    Note that 1.7 was old development version, and isn't supported.
     
    nobu.nokada, Jun 27, 2003
    #2
    1. Advertisements

  3. Ok, thank's for clarifying though. Next week I'll see whether I can get a
    newer Win installation.

    robert
     
    Robert Klemme, Jun 27, 2003
    #3
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.