From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=AWL,BAYES_00, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by dcvr.yhbt.net (Postfix) with ESMTP id C4F8F1F4B4 for ; Sat, 2 Jan 2021 10:53:46 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id A6773120A98; Sat, 2 Jan 2021 19:52:56 +0900 (JST) Received: from xtrwkhkc.outbound-mail.sendgrid.net (xtrwkhkc.outbound-mail.sendgrid.net [167.89.16.28]) by neon.ruby-lang.org (Postfix) with ESMTPS id 9C8B9120A76 for ; Sat, 2 Jan 2021 19:52:54 +0900 (JST) Received: by filterdrecv-p3las1-685fdc5bbc-qsvm8 with SMTP id filterdrecv-p3las1-685fdc5bbc-qsvm8-20-5FF050B3-20 2021-01-02 10:53:39.941917598 +0000 UTC m=+1943484.467445588 Received: from herokuapp.com (unknown) by ismtpd0015p1iad2.sendgrid.net (SG) with ESMTP id S1ZQ1q2vSRWYu6vMMK93Mg for ; Sat, 02 Jan 2021 10:53:39.829 +0000 (UTC) Date: Sat, 02 Jan 2021 10:53:39 +0000 (UTC) From: nobu@ruby-lang.org Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 77783 X-Redmine-Project: ruby-master X-Redmine-Issue-Tracker: Feature X-Redmine-Issue-Id: 17472 X-Redmine-Issue-Author: naruse X-Redmine-Sender: nobu X-Mailer: Redmine X-Redmine-Host: bugs.ruby-lang.org X-Redmine-Site: Ruby Issue Tracking System X-Auto-Response-Suppress: All Auto-Submitted: auto-generated X-SG-EID: =?us-ascii?Q?q8Dly+pU2+3ektTtZVXgZtbJPXwqo7p86jCsvYTW4BxHJZ3cLndi=2F5u2OyRzNt?= =?us-ascii?Q?Zfw1UEg2=2FCci5gICvvrCCUaUtfQW0QaWGQBrR5R?= =?us-ascii?Q?tZC6hii1ptPJXIlCxP8wWeG7+6GmVQ2mRpuuaPY?= =?us-ascii?Q?i=2FhsI=2Fv14xbPW3t8iwutDlg1nKuZH4i9h4U1V42?= =?us-ascii?Q?VNP2NazUtKZf9h7haPQ2tlHEB1lEZMFJdXY4IZ7?= =?us-ascii?Q?a9+4H9W64hYaKvYCs=3D?= To: ruby-core@ruby-lang.org X-Entity-ID: b/2+PoftWZ6GuOu3b0IycA== X-ML-Name: ruby-core X-Mail-Count: 101877 Subject: [ruby-core:101877] [Ruby master Feature#17472] HashWithIndifferentAccess like Hash extension X-BeenThere: ruby-core@ruby-lang.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Ruby developers List-Id: Ruby developers List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" Issue #17472 has been updated by nobu (Nobuyoshi Nakada). I had a vague original idea for this proposal, which extends the Hash class generically. First I though about case-insensitive string hashes, it had been able by using `$=` in old days. The special variable was removed, still there are that use cases, e.g., HTTP headers, command completions, etc. As I glanced st.c again this time, confirmed that customizing key conversion per instances isn't possible as far as keeping the backward compatibility. I think case-insensitive (only for String) Hash, like hashes compared by identity, would be possible, though. ---------------------------------------- Feature #17472: HashWithIndifferentAccess like Hash extension https://bugs.ruby-lang.org/issues/17472#change-89718 * Author: naruse (Yui NARUSE) * Status: Open * Priority: Normal * Target version: 3.1 ---------------------------------------- Rails has [ActiveSupport::HashWithIndifferentAccess](https://api.rubyonrails.org/classes/ActiveSupport/HashWithIndifferentAccess.html), which is widely used in Rails to handle Request, Session, ActionView's form construction, ActiveRecord's DB communication, and so on. It receives String or Symbol and normalize them to fetch the value. But it is implemented with Ruby. If we provide C implementation of that, Rails will gain the performance improvement. summary of previous discussion: https://github.com/rails/rails/pull/40182#issuecomment-687607812 -- https://bugs.ruby-lang.org/