Project

General

Profile

Actions

Feature #8939

closed

symbol / string invariance (for hashes)

Added by Sing9898 (Sing Lou) about 11 years ago. Updated about 11 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 master - Feature #7797: Hash should be renamed to StrictHash and a new Hash should be created to behave like AS HashWithIndifferentAccessRejectedmatz (Yukihiro Matsumoto)02/07/2013Actions

Updated by Hanmac (Hans Mackowiak) about 11 years ago

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

Actions #2

Updated by Sing9898 (Sing Lou) about 11 years ago

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

Updated by Hanmac (Hans Mackowiak) about 11 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) about 11 years ago

yes,duplicate, thanks

Updated by nagachika (Tomoyuki Chikanaga) about 11 years ago

  • Status changed from Open to Closed
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0