Project

General

Profile

Feature #8939

symbol / string invariance (for hashes)

Added by Sing9898 (Sing Lou) over 5 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-core:57316]

Description

hash={key:"value"}
hash["key"] should return "value"

hash={"key"=>"value"}
hash[:key] should return "value"


Related issues

Is duplicate of Ruby trunk - Feature #7797: Hash should be renamed to StrictHash and a new Hash should be created to behave like AS HashWithIndifferentAccessRejected02/07/2013Actions

History

Updated by Hanmac (Hans Mackowiak) over 5 years ago

no it should not because Symbol and String are two different Classes,
if you want that are the same use ActiveSupport::HashWithIndifferentAccess

#2

Updated by Sing9898 (Sing Lou) over 5 years ago

Update: then let's make HashWithIndifferentAccess the standard hash somehow

Updated by Hanmac (Hans Mackowiak) over 5 years ago

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)

Updated by Sing9898 (Sing Lou) over 5 years ago

yes,duplicate, thanks

Updated by nagachika (Tomoyuki Chikanaga) over 5 years ago

  • Status changed from Open to Closed

Also available in: Atom PDF