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_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 ADB951F5AE for ; Tue, 20 Jul 2021 07:53:48 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id E9453120937; Tue, 20 Jul 2021 16:52:28 +0900 (JST) Received: from o1678948x4.outbound-mail.sendgrid.net (o1678948x4.outbound-mail.sendgrid.net [167.89.48.4]) by neon.ruby-lang.org (Postfix) with ESMTPS id DEE9512091D for ; Tue, 20 Jul 2021 16:52:25 +0900 (JST) Received: by filterdrecv-66dddc765f-9cbxs with SMTP id filterdrecv-66dddc765f-9cbxs-1-60F68100-52 2021-07-20 07:53:36.926286635 +0000 UTC m=+460612.969052204 Received: from herokuapp.com (unknown) by ismtpd0188p1mdw1.sendgrid.net (SG) with ESMTP id FgNdboycQay34gw9N2PIrA for ; Tue, 20 Jul 2021 07:53:36.805 +0000 (UTC) Date: Tue, 20 Jul 2021 07:53:37 +0000 (UTC) From: shugo@ruby-lang.org Message-ID: References: Mime-Version: 1.0 X-Redmine-Project: ruby-master X-Redmine-Issue-Tracker: Bug X-Redmine-Issue-Id: 17429 X-Redmine-Issue-Author: shugo X-Redmine-Issue-Assignee: matz X-Redmine-Sender: shugo 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: 80781 X-SG-EID: =?us-ascii?Q?A4qw=2FE7uJv6zjRy5ZA2RlSNSopH4PRxwlkqj2Qg3aeREwfPRerKKbcoDTn=2F+6k?= =?us-ascii?Q?X4NnKUa4eSygrszVO2MlSTSOyqa+QZ2G7hDirh1?= =?us-ascii?Q?gEogXWn8TzkWd9tZG1JGyxFkbG=2FsDx0L7vFrYmv?= =?us-ascii?Q?mAExxRFNp7Sd7dkJ6ARq=2FMZ+6w159iBw3QzEISO?= =?us-ascii?Q?XfVn5Zbb2u7eff3Ew4sf09RpH6dwH9lsFBA=3D=3D?= To: ruby-core@ruby-lang.org X-Entity-ID: b/2+PoftWZ6GuOu3b0IycA== X-ML-Name: ruby-core X-Mail-Count: 104651 Subject: [ruby-core:104651] [Ruby master Bug#17429] Prohibit include/prepend in refinement modules 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 #17429 has been updated by shugo (Shugo Maeda). Eregon (Benoit Daloze) wrote in #note-20: > One more issue reported due these confusing semantics of include/prepend inside `refine`: #18021. > > I suggest we warn in 3.1, raise in 3.2. > And I suggest to add `Refinement#import`, because: > * `mix` seems to imply other things, and if it's ever added to Module with different semantics we will just get more confusion. > * `include` seems likely to cause confusion because the behavior would not be Module#include-like. It is also potentially backward-incompatible, raises the question about what would happen for `prepend` and consistency. And finnaly `include` would not longer mean "define higher in the ancestor" for this context, i.e., defining the same method in the refine block would replace, not just override). I've implemented Refinement#import in https://github.com/shugo/ruby/pull/3 In the current implementation, the module in cref is replaced with the refinement like Module#dup, so constants in the imported module are not accessible from the copied methods. It would be possible to support constant access with a hack on cref, but I'm afraid it may bring new problems. Maybe Refinement#import_methods is a better name if we keep the current behavior. ---------------------------------------- Bug #17429: Prohibit include/prepend in refinement modules https://bugs.ruby-lang.org/issues/17429#change-92960 * Author: shugo (Shugo Maeda) * Status: Open * Priority: Normal * Assignee: matz (Yukihiro Matsumoto) * Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN ---------------------------------------- include/prepend in refinement modules has implementation difficulties such as #17007 and #17379, and tends to be misleading like #17374. How about to prohibit it in future versions? Method copy like #17380 may be more convenient, but it's confusing to use names include and prepend because semantics is different from the original ones. -- https://bugs.ruby-lang.org/