Project

General

Profile

Actions

Feature #8939

closed

symbol / string invariance (for hashes)

Feature #8939: symbol / string invariance (for hashes)

Added by Sing9898 (Sing Lou) about 12 years ago. Updated about 12 years ago.

Status:
Closed
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 1 (0 open1 closed)

Is duplicate of Ruby - Feature #7797: Hash should be renamed to StrictHash and a new Hash should be created to behave like AS HashWithIndifferentAccessRejectedmatz (Yukihiro Matsumoto)Actions

Updated by Hanmac (Hans Mackowiak) about 12 years ago Actions #1 [ruby-core:57317]

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

Updated by Sing9898 (Sing Lou) about 12 years ago Actions #2

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

Updated by Hanmac (Hans Mackowiak) about 12 years ago Actions #3 [ruby-core:57321]

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) about 12 years ago Actions #4 [ruby-core:57324]

yes,duplicate, thanks

Updated by nagachika (Tomoyuki Chikanaga) about 12 years ago Actions #5 [ruby-core:57655]

  • Status changed from Open to Closed
Actions

Also available in: PDF Atom