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-ASN: AS4713 221.184.0.0/13 X-Spam-Status: No, score=-4.1 required=3.0 tests=AWL,BAYES_00, 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 454A41F8C6 for ; Thu, 15 Jul 2021 06:22:47 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 02013120A00; Thu, 15 Jul 2021 15:21:32 +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 E9CC31209E7 for ; Thu, 15 Jul 2021 15:21:29 +0900 (JST) Received: by filterdrecv-574dbbbf6c-rx4vv with SMTP id filterdrecv-574dbbbf6c-rx4vv-1-60EFD431-40 2021-07-15 06:22:41.997376358 +0000 UTC m=+23083.677102777 Received: from herokuapp.com (unknown) by geopod-ismtpd-4-1 (SG) with ESMTP id 1qAMDUbqQv-7GDWsRjmTKw for ; Thu, 15 Jul 2021 06:22:41.927 +0000 (UTC) Date: Thu, 15 Jul 2021 06:22:42 +0000 (UTC) From: nobu@ruby-lang.org Message-ID: References: Mime-Version: 1.0 X-Redmine-Project: ruby-master X-Redmine-Issue-Tracker: Bug X-Redmine-Issue-Id: 17719 X-Redmine-Issue-Author: nobu 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-Redmine-MailingListIntegration-Message-Ids: 80738 X-SG-EID: =?us-ascii?Q?q8Dly+pU2+3ektTtZVXgZtbJPXwqo7p86jCsvYTW4BxSNYPvOhFCLgOfSn7=2F6j?= =?us-ascii?Q?Q4RELNfXbeTChRHG2tkdvI4mgkWp3ZM1NIr2H+P?= =?us-ascii?Q?79rEqp2i1zC71wWgXEwiEIUyH3HiG0Z3mLfvWQg?= =?us-ascii?Q?t8G7djwaSbhZS3u=2FJuhVrOYv3vs5niTtZ0uwXZF?= =?us-ascii?Q?DW31sjhpXoAbmfay6qjzle7N7sb0V7XY7Tw=3D=3D?= To: ruby-core@ruby-lang.org X-Entity-ID: b/2+PoftWZ6GuOu3b0IycA== X-ML-Name: ruby-core X-Mail-Count: 104611 Subject: [ruby-core:104611] [Ruby master Bug#17719] Irregular evaluation order in hash literals 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 #17719 has been updated by nobu (Nobuyoshi Nakada). I think it can be fixed by removing the optimization in the parser and leaving it to the compiler. ---------------------------------------- Bug #17719: Irregular evaluation order in hash literals https://bugs.ruby-lang.org/issues/17719#change-92898 * Author: nobu (Nobuyoshi Nakada) * Status: Open * Priority: Normal * Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN ---------------------------------------- @mame pointed out an irregular evaluation order example. ```sh $ ruby -e '{foo:p(1), bar:p(2), foo:p(3)}' -e:1: warning: key :foo is duplicated and overwritten on line 1 1 3 2 ``` It feels like a bug. https://github.com/nobu/ruby/tree/duplicated-keys-order Or, probably it would be better to turn into an error? -- https://bugs.ruby-lang.org/