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.7 required=3.0 tests=AWL,BAYES_00, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,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 211731F453 for ; Thu, 7 Feb 2019 06:35:47 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 1774F118F76; Thu, 7 Feb 2019 15:35:44 +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 23E6A121568 for ; Thu, 7 Feb 2019 15:35:41 +0900 (JST) Received: by filter0182p3mdw1.sendgrid.net with SMTP id filter0182p3mdw1-12092-5C5BD1BB-D 2019-02-07 06:35:39.621320117 +0000 UTC m=+126314.474656259 Received: from herokuapp.com (ec2-54-80-77-200.compute-1.amazonaws.com [54.80.77.200]) by ismtpd0054p1mdw1.sendgrid.net (SG) with ESMTP id Ri3t9en4R0ShMpdY_Nn79A for ; Thu, 07 Feb 2019 06:35:39.624 +0000 (UTC) Date: Thu, 07 Feb 2019 06:35:41 +0000 (UTC) From: matz@ruby-lang.org To: ruby-core@ruby-lang.org Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 66906 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 14344 X-Redmine-Issue-Author: kddeisz X-Redmine-Sender: matz 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: ync6xU2WACa70kv/Ymy4QrNMhiuLXJG8OTL2vJD1yS5EqaHZgfA7YA8Wj885h/7hrjcwAHcWj/4cxP n4BU8J4IVFzrJ13D/cNtYhLTVKiIJwZDd2TjGp1w767rfW0TSGjOk0kBWxJHvI8Lir0KLm1cM5cmij vcUXeiRKgS78fhc7+m4JQsAidxArK2aLjCncxVpGOdjjKTP+TGYJ8zF95w== X-ML-Name: ruby-core X-Mail-Count: 91452 Subject: [ruby-core:91452] [Ruby trunk Feature#14344] refine at class level 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 #14344 has been updated by matz (Yukihiro Matsumoto). Status changed from Open to Rejected I understand the need. But I cannot accept the proposed syntax for two reasons. (1) the original proposal using `refine` for classes, which is confusing with `refine` in refinement modules. (2) the modified syntax `using do` is also confusing. The scope of refinement may be in the block or the surrounding scope. Matz. ---------------------------------------- Feature #14344: refine at class level https://bugs.ruby-lang.org/issues/14344#change-76712 * Author: kddeisz (Kevin Deisz) * Status: Rejected * Priority: Normal * Assignee: * Target version: ---------------------------------------- I rely on refinements a lot, but don't want to keep writing `Module.new` in code. I'm proposing `Object::refine`, which would create an anonymous module behind the scenes with equivalent functionality. So: ~~~ ruby class Test using Module.new { refine String do def refined? true end end } end ~~~ would become ~~~ ruby class Test refine String do def refined? true end end end ~~~ It's a small change, but reads a lot more clearly. Thoughts? -- https://bugs.ruby-lang.org/