Hi,
In message "Re: Some (accidental?) syntax changes 1.8 -> 1.9"
on Wed, 9 Jan 2008 00:20:02 +0900, "Florian Frank" <flori / nixe.ping.de> writes:
|I stumbled across some syntax changes, and I don't know if they are
|intended that way or oversights.
|
|1. This doesn't work anymore in Ruby 1.9 and causes this error message:
It's intentional. The colon separator was accidental, and I'd like to
keep colon for another purpose for the future.
|2. This prints 1, 2, and 3 in Ruby 1.8:
|
|b = [1,2,3]
|loop {
| a = if true then b.shift or break end
| p a
|}
|
|In 1.9 the 'b.shift or break' causes a "void value expression" error,
|even though the expression does return a non-void value three times. I
|admit, that this is rather hackish code, though. ;)
In 1.9, the warning was caused by the better value analysis. The line
is essentially same as
a = (b.shift or break)
which really is using void value.
matz.