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=-3.9 required=3.0 tests=AWL,BAYES_00, MAILING_LIST_MULTI,PLING_QUERY,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS 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 E7BBB1F463 for ; Mon, 6 Jan 2020 09:46:47 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 9E920120A0D; Mon, 6 Jan 2020 18:46:34 +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 6ED301209F6 for ; Mon, 6 Jan 2020 18:46:32 +0900 (JST) Received: by filterdrecv-p3mdw1-56c97568b5-9vfcv with SMTP id filterdrecv-p3mdw1-56c97568b5-9vfcv-17-5E1301FD-2C 2020-01-06 09:46:37.522975147 +0000 UTC m=+1760606.145538060 Received: from herokuapp.com (unknown [54.91.247.56]) by ismtpd0010p1iad1.sendgrid.net (SG) with ESMTP id LBaDmj9GSs2KnAFKLpG5HA for ; Mon, 06 Jan 2020 09:46:37.499 +0000 (UTC) Date: Mon, 06 Jan 2020 09:46:37 +0000 (UTC) From: mame@ruby-lang.org Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 72349 X-Redmine-Project: ruby-master X-Redmine-Issue-Id: 16486 X-Redmine-Issue-Author: mame X-Redmine-Sender: mame 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?EJh2gqwnyqXtd++xo=2FinyA1V0bXouTB4FkWnzNiKb4+68b92XjA2C9aa4Tjk9E?= =?us-ascii?Q?uavW1ch+K=2FLtqjVoSHYhBS3pxwRCT1uaEQlgCw5?= =?us-ascii?Q?u1IGaBN6f=2FNoY0aCgS9ZHhGdMVV5o1IW0aGj1vY?= =?us-ascii?Q?S3Cie5M9JPAfIJq8Nr8RyI4iwnuN18exsYzxPJ5?= =?us-ascii?Q?dpj322ijV=2FuY1pdc5SIgqHMX2oO2zf6kTUq8OIB?= =?us-ascii?Q?QntXraa=2FuX+31yH5Y=3D?= To: ruby-core@ruby-lang.org X-ML-Name: ruby-core X-Mail-Count: 96687 Subject: [ruby-core:96687] [Ruby master Feature#16486] Hash.ruby2_keywords?(hash) and Hash.ruby2_keywords!(hash) 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 #16486 has been reported by mame (Yusuke Endoh). ---------------------------------------- Feature #16486: Hash.ruby2_keywords?(hash) and Hash.ruby2_keywords!(hash) https://bugs.ruby-lang.org/issues/16486 * Author: mame (Yusuke Endoh) * Status: Open * Priority: Normal * Assignee: * Target version: ---------------------------------------- Hash's ruby2_keywords flag is designed to be as implicit as possible, but unfortunately, sometimes we need to handle the flag explicitly. In ActiveJob, the whole arguments are serialized and deserialized, and the process removes the flag; in this case, we need to check and save the flag when serializing, and restore the flag when deserializing. https://github.com/rails/rails/pull/38105#discussion_r361863767 It is theoretically possible by [a very hacky code](https://gist.github.com/mame/18cd2dfc7d965d0bad1216f2fdd008ee#file-bouncing_test-patch-L117-L134), but it would be good to provide them officially. https://github.com/ruby/ruby/pull/2818 * `Hash.ruby2_keywords?(hash)` checks if hash is flagged or not. * `Hash.ruby2_keywords!(hash)` flags a given hash. The reason why I don't add them as instance methods (`Hash#ruby2_keywords?`) is that they are never for casual use. The ruby2_keywords flag will be removed after enough migration time. Casual use of them will make it difficult to remove, so I'd like to keep them for non-casual use. (I thought `RubyVM.ruby2_keywords?(hash)` is good but @eregon will be against it :-) @jeremyevans0 Could you tell me your opinion? -- https://bugs.ruby-lang.org/