From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: poffice@blade.nagaokaut.ac.jp Delivered-To: poffice@blade.nagaokaut.ac.jp Received: from kankan.nagaokaut.ac.jp (kankan.nagaokaut.ac.jp [133.44.2.24]) by blade.nagaokaut.ac.jp (Postfix) with ESMTP id 369A41A600EE for ; Wed, 29 Jun 2016 21:58:28 +0900 (JST) Received: from voscc.nagaokaut.ac.jp (voscc.nagaokaut.ac.jp [133.44.1.100]) by kankan.nagaokaut.ac.jp (Postfix) with ESMTP id F01C5B5D9C8 for ; Wed, 29 Jun 2016 22:33:08 +0900 (JST) Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by voscc.nagaokaut.ac.jp (Postfix) with ESMTP id A208118CC81A for ; Wed, 29 Jun 2016 22:33:09 +0900 (JST) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 573B4120455; Wed, 29 Jun 2016 22:33:09 +0900 (JST) X-Original-To: ruby-core@ruby-lang.org Delivered-To: ruby-core@ruby-lang.org Received: from o2.heroku.sendgrid.net (o2.heroku.sendgrid.net [67.228.50.55]) by neon.ruby-lang.org (Postfix) with ESMTPS id 1E827120442 for ; Wed, 29 Jun 2016 22:33:05 +0900 (JST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sendgrid.me; h=from:to:references:subject:mime-version:content-type:content-transfer-encoding:list-id; s=smtpapi; bh=NvG0/r6N9k69gT+gwU65oNbXQbo=; b=wiLU56HNF9qhUS0eEJ jtY2MD6WBd3zw207MdGKF9Ihxc1NESgweLQ2pSAFyPoFyltiIzbHEu5GLLfaw+yL nYa8XQaLzOr/LPrO2d+YRA4u57p3QDIk/m9GHevSmKcKv9Y+30QV54GNZjCovcq0 5hVb5/knjKS+lkwOMQvEye7D8= Received: by filter0812p1mdw1.sendgrid.net with SMTP id filter0812p1mdw1.19882.5773CDD827 2016-06-29 13:32:08.252928775 +0000 UTC Received: from herokuapp.com (ec2-54-80-204-171.compute-1.amazonaws.com [54.80.204.171]) by ismtpd0003p1iad1.sendgrid.net (SG) with ESMTP id 1NuV8U0cQOyy69s9lF6lew for ; Wed, 29 Jun 2016 13:32:08.260 +0000 (UTC) Date: Wed, 29 Jun 2016 13:32:08 +0000 From: futu.fata@gmail.com To: ruby-core@ruby-lang.org Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 50936 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 12533 X-Redmine-Issue-Author: chucke X-Redmine-Sender: akhramov 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/Ymy4QrNMhiuLXJG8OTL2vJD1yS4tD0H9gFsFrbm7ArS1kDWGQ3VXs9EdxiMjNS JnqRXMUqEZCUKFv/Cad1gsYFOZo4bnnTVpG2h79pyc4hl7taQdMMlv0OVx3IZmrbrUu/C11tx9Ahjl psszzW8iXg+S+C7tbnhYBwPBEMo1QrMFr8gReJdhCNnHTleu2pZjwhabGg== X-ML-Name: ruby-core X-Mail-Count: 76205 Subject: [ruby-core:76205] [Ruby trunk Feature#12533] Refinements: allow modules inclusion, in which the module can call internal methods which it defines. 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 #12533 has been updated by Artem Khramov. Description updated ---------------------------------------- Feature #12533: Refinements: allow modules inclusion, in which the module can call internal methods which it defines. https://bugs.ruby-lang.org/issues/12533#change-59421 * Author: Tiago Cardoso * Status: Open * Priority: Normal * Assignee: ---------------------------------------- Right now this isn't possible: ~~~ruby module Extensions def vegetables ; potatoe ; end def potatoe ; "potatoe" ; end end module Refinary refine String do # this doesn't work include Extensions # this would work... # def vegetables ; potatoe ; end # def potatoe ; "potatoe" ; end end end using Refinary puts "tomatoe".vegetables #=> in
': undefined method 'vegetables' for "tomatoe":String ~~~ Wrongly reported as a bug [here](https://bugs.ruby-lang.org/issues/12514). According to Shugo Maeda, this was expected behaviour. I argued that this is the way most monkey-patches work, and if Refinements can't cover the use case of inserting a custom DSL which references itself in the classes it refines, it can't fully replace monkey-patches, which I read was the main reason Refinements have been added to the language. -- https://bugs.ruby-lang.org/