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.9 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, 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 36AF31F4B4 for ; Wed, 31 Mar 2021 00:19:38 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 0D45D120E72; Wed, 31 Mar 2021 09:18:35 +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 27A01120E71 for ; Wed, 31 Mar 2021 09:18:33 +0900 (JST) Received: by filterdrecv-p3las1-699f5f7ff5-vl2kb with SMTP id filterdrecv-p3las1-699f5f7ff5-vl2kb-20-6063C011-1A 2021-03-31 00:19:29.3673222 +0000 UTC m=+625587.082253051 Received: from herokuapp.com (unknown) by geopod-ismtpd-4-2 (SG) with ESMTP id bqqH6Sq2QqWqgkm3URPUzQ for ; Wed, 31 Mar 2021 00:19:29.119 +0000 (UTC) Date: Wed, 31 Mar 2021 00:19:29 +0000 (UTC) From: duerst@it.aoyama.ac.jp Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 79154 X-Redmine-Project: ruby-master X-Redmine-Issue-Tracker: Feature X-Redmine-Issue-Id: 17472 X-Redmine-Issue-Author: naruse X-Redmine-Sender: duerst 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?uQY=2F2xNrNfHHTWbKn6MBvvzfU5Pqk9I4lnOVb0CFDutlLGePJBi3YGAzBgdmr6?= =?us-ascii?Q?QXPKMpjSqbB07qm2HoXV0E3YNPVWfPsHF=2FCoPTE?= =?us-ascii?Q?6zXT9ZjILHKu5jaie5NBNErhk=2FEpQxf0uvOtC2w?= =?us-ascii?Q?QjXal04ReUHVjgBelX46J3rd+Td9UKPjaGF4H4y?= =?us-ascii?Q?LcS7ZEw1GhxQXUClU+Fk5pgQTSR9WHcmf2x7AD=2F?= =?us-ascii?Q?W8pdpHEKnjGSlpFXk=3D?= To: ruby-core@ruby-lang.org X-Entity-ID: b/2+PoftWZ6GuOu3b0IycA== X-ML-Name: ruby-core X-Mail-Count: 103119 Subject: [ruby-core:103119] [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="iso-8859-1" Content-Transfer-Encoding: quoted-printable Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" Issue #17472 has been updated by duerst (Martin D=FCrst). marcandre (Marc-Andre Lafortune) wrote in #note-21: > duerst (Martin D=FCrst) wrote in #note-20: > > Javascript doesn't have symbols in the first place > = > Actually, it does (since ES 6): https://developer.mozilla.org/en-US/docs/= Web/JavaScript/Reference/Global_Objects/Symbol Thanks for the pointer. I haven't fully understood that page, but it seems = to me that in JS, the 'uniqueness' aspect is much more important, and there= are less similarities with strings than in Ruby. Also, the interface on JS= symbols is much smaller than in Ruby, and quite inconvenient except for so= me very narrow use cases. joelb (Joel Blum) wrote in #note-22: > > Actually, it does (since ES 6): https://developer.mozilla.org/en-US/doc= s/Web/JavaScript/Reference/Global_Objects/Symbol > = > I find it very unlikely any language will make symbols the default hash k= eys like Ruby did. Definitely not JS, see above. But what about various Lisp variants? > > String are meant for input/output of text. Symbols are identifier for d= evelopers. > = > Why do you need that distinction? You don't need that distinction. There is also no need to distinguish integ= ers and floats. Most programming languages make that distinction, but some,= including JS, don't (or didn't?). There is also no strict need to distinguish between strings and numbers. Al= most all programming languages have such a distinction, but in Perl (+most = shells, awk,...), a string that looks like a number is just a number, and a= ny number is a string. Some languages (e.g. Python, Haskell) provide arrays= and tuples, others (e.g. Ruby, JS last time I checked) have only arrays. S= ome languages distinguish between characters and strings (Ruby up to versio= n 1.8, C), others don't (Ruby from version 1.9,...). Each choice has its reasons, advantages, and disadvantages. If all programm= ing languages were the same, it would be very boring. ---------------------------------------- Feature #17472: HashWithIndifferentAccess like Hash extension https://bugs.ruby-lang.org/issues/17472#change-91187 * Author: naruse (Yui NARUSE) * Status: Open * Priority: Normal * Target version: 3.1 ---------------------------------------- Rails has [ActiveSupport::HashWithIndifferentAccess](https://api.rubyonrail= s.org/classes/ActiveSupport/HashWithIndifferentAccess.html), which is widel= y used in Rails to handle Request, Session, ActionView's form construction,= ActiveRecord's DB communication, and so on. It receives String or Symbol a= nd normalize them to fetch the value. But it is implemented with Ruby. If w= e provide C implementation of that, Rails will gain the performance improve= ment. summary of previous discussion: https://github.com/rails/rails/pull/40182#i= ssuecomment-687607812 -- = https://bugs.ruby-lang.org/ Unsubscribe: