Project

General

Profile

Bug #4259

Symbol syntactic sugar in Hashes does not work with quotes

Added by tbenst (Tyler Benster) over 9 years ago. Updated about 9 years ago.

Status:
Rejected
Priority:
Normal
Assignee:
-
Target version:
ruby -v:
ruby 1.9.2p136 (2010-12-25 revision 30365) [x86_64-darwin10.5.0]
Backport:
[ruby-core:34322]

Description

=begin
To reproduce the problem, try the following in irb:

hash = {Alabama: "AL"}
=> {:Alabama=>"AL"}
puts hash[:"Alabama"]
AL
=> nil
hash2 = {"Rhode Island": "RI"}
SyntaxError: (irb):3: syntax error, unexpected ':', expecting tASSOC
hash2 = {"Rhode Island": "RI"}
^
(irb):3: syntax error, unexpected '}', expecting $end
from /usr/local/bin/irb:12:in `'
hash2 = {:"Rhode Island" => "RI"}
=> {:"Rhode Island"=>"RI"}
=end

#1

Updated by sorah (Sorah Fukumori) over 9 years ago

=begin
I think this is spec...

--sora_h
=end

#2

Updated by sorah (Sorah Fukumori) over 9 years ago

  • Status changed from Open to Rejected

=begin
Matz said this is true spec. Please write feature request if you want.

http://twitter.com/yukihiro_matz/status/24669795119013888
In English,

This is not a bug. But I can understand if this is feature request.

Closing.

--sora_h
=end

Also available in: Atom PDF