Project

General

Profile

Feature #12352

New hash syntax broken for numeric keys

Added by adrianomitre (Adriano Mitre) over 4 years ago. Updated over 4 years ago.

Status:
Rejected
Priority:
Normal
Target version:
-
[ruby-core:75375]

Description

[Matz himself showed in RubyConf 2015 the following example]:

h = { 1: 2, 2: 4, 3: 6 }

Which gives

SyntaxError: unexpected ':', expecting =>
h = { 1: 2, 2: 4, 3: 6 }
        ^

but which should give identical results to

>> h = { 1 => 2, 2 => 4, 3 => 6 }
=> {1=>2, 2=>4, 3=>6}

Also available in: Atom PDF