Feature #8939
closed
symbol / string invariance (for hashes)
Added by Sing9898 (Sing Lou) about 11 years ago.
Updated about 11 years ago.
Description
hash={key:"value"}
hash["key"] should return "value"
hash={"key"=>"value"}
hash[:key] should return "value"
no it should not because Symbol and String are two different Classes,
if you want that are the same use ActiveSupport::HashWithIndifferentAccess
Update: then let's make HashWithIndifferentAccess the standard hash somehow
Duplicate of Feature #7797 "Hash should be renamed to StrictHash and a new Hash should be created to behave like AS HashWithIndifferentAccess"
others like
Feature #7792 "Make symbols and strings the same thing"
are rejected
you RailsGuys need to understand that there are both String and Symbol and both does have pro and con facts
(always turning sym <-> str is not a good idea)
- Status changed from Open to Closed
Also available in: Atom
PDF
Like0
Like0Like0Like0Like0Like0