[#63592] [ruby-trunk - Bug #10009] IO operation is 10x slower in multi-thread environment — normalperson@...
Issue #10009 has been updated by Eric Wong.
3 messages
2014/07/08
[#63682] [ruby-trunk - Feature #10030] [PATCH] reduce rb_iseq_struct to 296 bytes — ko1@...
Issue #10030 has been updated by Koichi Sasada.
3 messages
2014/07/13
[#63703] [ruby-trunk - Feature #10030] [PATCH] reduce rb_iseq_struct to 296 bytes — ko1@...
Issue #10030 has been updated by Koichi Sasada.
3 messages
2014/07/14
[#63743] [ruby-trunk - Bug #10037] Since r46798 on Solaris, "[BUG] rb_vm_get_cref: unreachable" during make — ngotogenome@...
Issue #10037 has been updated by Naohisa Goto.
3 messages
2014/07/15
[#64136] Ruby 2.1.2 (and 2.1.1 and probably others) assumes a libffi with 3 version numbers in extconf.rb — "Jeffrey 'jf' Lim" <jfs.world@...>
As per subject.
4 messages
2014/07/31
[#64138] Re: Ruby 2.1.2 (and 2.1.1 and probably others) assumes a libffi with 3 version numbers in extconf.rb
— "Jeffrey 'jf' Lim" <jfs.world@...>
2014/07/31
On Thu, Jul 31, 2014 at 6:03 PM, Jeffrey 'jf' Lim <[email protected]>
[ruby-core:63889] [ruby-trunk - Bug #9931] irb: Really weird behavior for x = "#{x\"}" (ex: irb(main:009:-4))
From:
jared@...
Date:
2014-07-20 02:52:01 UTC
List:
ruby-core #63889
Issue #9931 has been updated by Jared Beck.
Interesting. Let's try to figure it out!
## The irb prompt
The prompt has two numbers. The first is obviously a line number, but what is the second number?
irb(main):001:0> "#{
irb(main):002:0> end
irb(main):003:-1> end
irb(main):004:-2> do
irb(main):005:-1> do
irb(main):006:0> }"
SyntaxError: (irb):2: syntax error, unexpected keyword_end
(irb):6: unterminated string meets end of file
from /Users/jared/.rbenv/versions/2.1.2/bin/irb:11:in `<main>'
The second number seems to be a simple estimate of block depth. It must be implemented very simply, if it is capable of being negative.
## String interpolation is a block
irb(main):013:0> "#{
irb(main):014:0> [1, 2, 3].map { |x| x * 2 }
irb(main):015:0" }"
=> "[2, 4, 6]"
It's just a block! We can put whatever we want in there. :)
Note that on the third line, the prompt character changed from `>` to `"`, indicating (roughly) that `irb` thinks we're inside a string.
## The syntax error
In the given example
"#{x\"}"
the string is closed at col. 5. The contents of the string are:
#{x\
We can see that the interpolation block was not closed. So, the syntax error
expecting '}'
makes sense.
----------------------------------------
Bug #9931: irb: Really weird behavior for x = "#{x\"}" (ex: irb(main:009:-4))
https://bugs.ruby-lang.org/issues/9931#change-47916
* Author: Jesse Adkins
* Status: Open
* Priority: Normal
* Assignee:
* Category:
* Target version:
* ruby -v: ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-linux]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN
----------------------------------------
# Our journey starts off rather simple:
irb(main):001:0> x = "#{x}"
=> ""
# Okay, makes sense.
irb(main):002:0> x = "#{x\"}"
irb(main):003:0"
# Hmm...Still in a string? That's weird.
irb(main):003:0" "
irb(main):004:0>
# Things seem back to normal but...
irb(main):004:0> x
# Nothing? But x is defined!
irb(main):005:0>
# Nothing? Hmm...
irb(main):005:0> end
irb(main):006:-1> end
# Uhh...I don't think that's supposed to do that.
irb(main):007:-2> end
irb(main):008:-3> end
irb(main):009:-4>
# ...I'm afraid to go deeper.
# Get me out of here!
irb(main):009:-4> quit
irb(main):010:-4>
# O.O
irb(main):010:-4> ^C
irb(main):010:0>
# ...Can I go now?
irb(main):010:0> quit
# Success!
# Additionally, if I put this in a file:
x = "#{x\"}"
# I get two syntax errors (ruby 1.9.3):
test.rb:1: syntax error, unexpected $undefined, expecting '}'
x = "#{x\"}"
^
test.rb:1: syntax error, unexpected $end, expecting '}'
x = "#{x\"}"
^
--
https://bugs.ruby-lang.org/