From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS4713 221.184.0.0/13 X-Spam-Status: No, score=-3.6 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by dcvr.yhbt.net (Postfix) with ESMTP id F3EA81F404 for ; Tue, 17 Apr 2018 15:38:38 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 6F312120955; Wed, 18 Apr 2018 00:38:35 +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 3569F120937 for ; Wed, 18 Apr 2018 00:38:32 +0900 (JST) Received: by filter0020p3las1.sendgrid.net with SMTP id filter0020p3las1-26170-5AD614F3-57 2018-04-17 15:38:27.922183791 +0000 UTC Received: from herokuapp.com (ec2-184-73-71-41.compute-1.amazonaws.com [184.73.71.41]) by ismtpd0006p1iad2.sendgrid.net (SG) with ESMTP id aeaDjwHaST-lM9xIjjyeYw Tue, 17 Apr 2018 15:38:27.848 +0000 (UTC) Date: Tue, 17 Apr 2018 15:38:28 +0000 (UTC) From: kevin.deisz@gmail.com To: ruby-core@ruby-lang.org Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 61910 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 14344 X-Redmine-Issue-Author: kddeisz X-Redmine-Sender: kddeisz 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-CSA-Complaints: whitelist-complaints@eco.de X-SG-EID: ync6xU2WACa70kv/Ymy4QrNMhiuLXJG8OTL2vJD1yS6TEsdkIdtPtFJdT74rg5UG2EE950Ia9QKDGb xJXVng80pGGBjI6GBHd54ATbEDuw4YS66Le6g+u/ttdsOnT8Cq6fI7XLU5Lx8MDvh+qipHoEHFZQnt 3N2GYI4Db2DKB0UFXVuII28jI650YD1KSWF+IRN8fZhZYVslPhy9hofMRA== X-ML-Name: ruby-core X-Mail-Count: 86561 Subject: [ruby-core:86561] [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 kddeisz (Kevin Deisz). Thanks Benoit. A couple of suggestions would be: ~~~ anonymous_refine inline_refine class_refine refining refine_class ~~~ Any of these would be fine I think - `anonymous_refine` gets across that it's creating an anonymous module that will be used. `inline_refine` is similar in that sense. `class_refine` may be confusing in that it's not going up to the singleton class and refining. `refining` is inline with Rails' `concerning`, but doesn't particularly convey special meaning. `refine_class` gets across that it's only refining a specific class, which I kind of like the best. Would something like `refine_class` be amenable to the core team? ---------------------------------------- Feature #14344: refine at class level https://bugs.ruby-lang.org/issues/14344#change-71502 * Author: kddeisz (Kevin Deisz) * Status: Open * 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/