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=-3.8 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, 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 45ADF1F4B4 for ; Sun, 27 Dec 2020 17:13:28 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 86FB7120A0A; Mon, 28 Dec 2020 02:12:37 +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 BDB2D12090A for ; Mon, 28 Dec 2020 02:12:34 +0900 (JST) Received: by filterdrecv-p3mdw1-7474cd8bfd-d66mf with SMTP id filterdrecv-p3mdw1-7474cd8bfd-d66mf-19-5FE8C0AF-3B 2020-12-27 17:13:20.005011681 +0000 UTC m=+1447857.029209459 Received: from herokuapp.com (unknown) by geopod-ismtpd-6-7 (SG) with ESMTP id y-8b5yjvRhqn7VTbYLriRQ for ; Sun, 27 Dec 2020 17:13:19.930 +0000 (UTC) Date: Sun, 27 Dec 2020 17:13:20 +0000 (UTC) From: merch-redmine@jeremyevans.net Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 77653 X-Redmine-Project: ruby-master X-Redmine-Issue-Tracker: Feature X-Redmine-Issue-Id: 17472 X-Redmine-Issue-Author: naruse X-Redmine-Sender: jeremyevans0 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?RVE3t853K5scBhbmJHUzZTFFeVC=2FZSUmHZ0Dc+26wcEi2CTgsF1oz0wTSSxGGN?= =?us-ascii?Q?BIM3YNsS9=2Fehzm2qKd665769eHjPjNs138YKAcu?= =?us-ascii?Q?74=2F8LJC7aErlomE7j1TIFnHdJ8Z2CZHCsFe9SUx?= =?us-ascii?Q?g0kStJ9Pp5idlOKe4ZKV1lqf3hT1=2Fz44T=2FErJOi?= =?us-ascii?Q?GGyut8I+0RHg8kE6ABDxTFuAnVVBbRE10snrvJo?= =?us-ascii?Q?m6K=2F9lFv69yLusBUA=3D?= To: ruby-core@ruby-lang.org X-Entity-ID: b/2+PoftWZ6GuOu3b0IycA== X-ML-Name: ruby-core X-Mail-Count: 101751 Subject: [ruby-core:101751] [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 jeremyevans0 (Jeremy Evans). I am against adding this in principle. One of the harder things for new Ruby programmers to understand is the difference between symbols and strings. This is even more difficult for programmers learning Ruby and Rails at the same time, due to the fact that Rails treats symbols and strings the same in most places. I'm also against adding this for the reasons that @Eregon mentioned. If a speed-up is desired, `HashWithIndifferentAccess` can easily be a C-extension gem, there is no pressing reason to have it in core or stdlib. If we do decide to add this to Ruby, it should have a better name. `HashWithIndifferentAccess` is not indifferent in regards to type (`1` and `"1"` are different). `HashWithIndifferentAccess` is not indifferent in regards to case (`"a"` and `"A"` are different). `HashWithIndifferentAccess` is not indifferent in regards to encoding, at least some of the time (`"\u1234"` and `"\u1234".b` are different). "WithIndifferentAccess" is too vague. `HashCovertingSymbolKeysToStringKeys` is more accurate, though quite long. ---------------------------------------- Feature #17472: HashWithIndifferentAccess like Hash extension https://bugs.ruby-lang.org/issues/17472#change-89578 * 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. -- https://bugs.ruby-lang.org/