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 8D19D1A600EE for ; Wed, 29 Jun 2016 22:00:11 +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 55269B5D887 for ; Wed, 29 Jun 2016 22:34:52 +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 076EB18CC818 for ; Wed, 29 Jun 2016 22:34:53 +0900 (JST) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 82ECC12045C; Wed, 29 Jun 2016 22:34:53 +0900 (JST) X-Original-To: ruby-core@ruby-lang.org Delivered-To: ruby-core@ruby-lang.org Received: from o10.shared.sendgrid.net (o10.shared.sendgrid.net [173.193.132.135]) by neon.ruby-lang.org (Postfix) with ESMTPS id E217E120442 for ; Wed, 29 Jun 2016 22:34:48 +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=Smn1SXYtLTXbUQQyJe9rBG5zxbA=; b=sj/4yDqdY6Y8TC4oTe TnRmmU+aSjt316USLHhpP+ZdPmAxlu/ImqyncOWWrZOODBncY/Cy1nRQD9qRYinG +gCmxGz6ZFQxdDnsSLJGa2+yrEnvTGJUppnOhp3xq7bLH718FoIh6+O7px25awTi V2wvtlel8WyLl4gDrvRjFb5VM= Received: by filter0912p1mdw1.sendgrid.net with SMTP id filter0912p1mdw1.16677.5773CE6B34 2016-06-29 13:34:35.844638335 +0000 UTC Received: from herokuapp.com (ec2-54-80-204-171.compute-1.amazonaws.com [54.80.204.171]) by ismtpd0006p1iad1.sendgrid.net (SG) with ESMTP id YxWb06DvR4mLwVJnDg67YA for ; Wed, 29 Jun 2016 13:34:35.790 +0000 (UTC) Date: Wed, 29 Jun 2016 13:34:35 +0000 From: futu.fata@gmail.com To: ruby-core@ruby-lang.org Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 50937 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/Ymy4QrNMhiuLXJG8OTL2vJD1yS6Cvb+RcW++12MKjmHbM5qelJHQVPb0/wi8OY d1ceRDTjbszd0IQSZrkjKUpeJHnD4PLFg2YLmsGmt8sAFoTYgC91MQn59UVGNXnIWzbF26K3j+hscp LxReCExIt4fseSY+ra+dOwOWpJxMnJ3U05qP5uitb+OmaK6t9sj1SADusw== X-ML-Name: ruby-core X-Mail-Count: 76206 Subject: [ruby-core:76206] [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. Hi Tiago, the syntax is \~\~\~ruby your(code).goes here \~\~\~ Sorry for offtop. ---------------------------------------- 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-59422 * 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/