From: Mark Hubbart Date: 2004-07-18T02:34:20+09:00 Subject: Re: Bug? String literal %s{#{a}} cause irb to abort On Jul 17, 2004, at 7:52 AM, Alexey Verkhovsky wrote: > On Sat, 2004-07-17 at 17:10, nobu.nokada@softhome.net wrote: > >> But I don't know why it delays until the next line; > > You are right, it doesn't assign anything to the variable, just delays > reporting of the problem. E.g. > > [alex@dhcp-89-2 ruby]$ irb > irb(main):001:0> a=%s > irb(main):002:0: > irb(main):003:0> puts "aaa" > SyntaxError: compile error > (irb):2: empty symbol literal > (irb):3: syntax error > puts "aaa" > ^ > from (irb):3 > from :0 That's because newlines are valid delimiters in that context: irb(main):009:0> a=%s irb(main):010:0: testing irb(main):011:0> => :testing It delays because it's waiting for you to close out the literal. What you typed above is equivalent to this: a=%s{} puts "aaa"; so it give two errors: a compile error for the empty symbol, and a syntax error because to can't put puts where it is :) cheers, Mark