Bug #1389
closedUse of ":" as synonym for "do" and "then"
Description
=begin
A review of syntax.y from ruby 1.8.7 and 1.9.1 shows the grammar rule for then no longer includes the literal symbol ':'. This change causes commonly used idioms for case expressions and loops to fail. These no longer work:
case
when CONDITION :
BODY
end
while BOOLEAN :
BODY
end
until BOOLEAN :
BODY
end
for NAME in EXPRESSION :
BODY
end
Am I mistaken? Is this a feature?
=end
Updated by bitsweat (Jeremy Daer) over 15 years ago
=begin
It was an "accidental" feature in the first place. It's been removed to simplify the new hash literal syntax.
{a: "foo"} # => {:a=>"foo"}
=end
Updated by yugui (Yuki Sonoda) over 15 years ago
- Status changed from Open to Rejected
=begin
This change is intentional. See the line 28 in NEWS.
=end
Updated by matz (Yukihiro Matsumoto) over 15 years ago
=begin
If I had to (re)introduce colons after control structure, I'd remove "end" altogether to make it more Python-like. But I feel little chance on the idea.
matz.
=end