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 425A61960004 for ; Wed, 24 Jun 2015 14:38:41 +0900 (JST) Received: from funfun.nagaokaut.ac.jp (funfun.nagaokaut.ac.jp [133.44.2.201]) by kankan.nagaokaut.ac.jp (Postfix) with ESMTP id 78962B5D973 for ; Wed, 24 Jun 2015 15:02:40 +0900 (JST) Received: from funfun.nagaokaut.ac.jp (localhost.nagaokaut.ac.jp [127.0.0.1]) by funfun.nagaokaut.ac.jp (Postfix) with ESMTP id 3113497A82B for ; Wed, 24 Jun 2015 15:02:42 +0900 (JST) X-Virus-Scanned: amavisd-new at nagaokaut.ac.jp Authentication-Results: funfun.nagaokaut.ac.jp (amavisd-new); dkim=fail (1024-bit key) reason="fail (message has been altered)" header.d=sendgrid.me Received: from funfun.nagaokaut.ac.jp ([127.0.0.1]) by funfun.nagaokaut.ac.jp (funfun.nagaokaut.ac.jp [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id xOMHcAPCfoXF for ; Wed, 24 Jun 2015 15:02:42 +0900 (JST) Received: from voscc.nagaokaut.ac.jp (voscc.nagaokaut.ac.jp [133.44.1.100]) by funfun.nagaokaut.ac.jp (Postfix) with ESMTP id E9CA297A827 for ; Wed, 24 Jun 2015 15:02:41 +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 115B1952447 for ; Wed, 24 Jun 2015 15:02:39 +0900 (JST) Received: from [221.186.184.76] (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 1F5A912043D; Wed, 24 Jun 2015 15:02:38 +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 537C0120419 for ; Wed, 24 Jun 2015 15:02:34 +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=pXNR5P01qJ3apnMrR0NjhUGsqSI=; b=XRauyLMb3Owk6/dI1q tqEfj6xoXviQx7ydxib8imbWMSoVNc2pcNdj8JgdxJRB/DKQVVBfs25K4pDYo0mz PzcKqWFwr+wDdPmdQwktwDq4WNOuGBLtJPRRrJHwfhN7moURkDxI6EXGliP0vOf7 HBYqqcX577OobtLrhm8tBeP68= Received: by filter0480p1mdw1.sendgrid.net with SMTP id filter0480p1mdw1.30162.558A47F23 2015-06-24 06:02:28.964440414 +0000 UTC Received: from herokuapp.com (ec2-54-80-93-182.compute-1.amazonaws.com [54.80.93.182]) by ismtpd-032 (SG) with ESMTP id 14e242914db.527.105148 for ; Wed, 24 Jun 2015 06:02:28 +0000 (UTC) Date: Wed, 24 Jun 2015 06:02:28 +0000 From: shugo@ruby-lang.org To: ruby-core@ruby-lang.org Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Redmine-MailingListIntegration-Message-Ids: 44292 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 11246 X-Redmine-Issue-Author: ko1 X-Redmine-Issue-Assignee: shugo 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-SG-EID: ync6xU2WACa70kv/Ymy4QrNMhiuLXJG8OTL2vJD1yS7/ysQgOkh13pLLGxb7mi1u2VJN04TBVD3GR/ Q6YElk4g2Z6I3b75kFtMM8y1Uza5Kg7gir8sYE9ceoDOE554Q31CTiD+juBfjYN+MtLbJPCi4ZJEX5 zqwXZ6Tzr7wiJsXzF71jRSvR6/246U7ECMto X-ML-Name: ruby-core X-Mail-Count: 69723 Subject: [ruby-core:69723] [Ruby trunk - Bug #11246] [Rejected] refine block doesn't respect "lexical" refinement information 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: , Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" Issue #11246 has been updated by Shugo Maeda. Status changed from Open to Rejected Koichi Sasada wrote: > The following program making two refinements refine class C. > > ```ruby > class C > def foo > p C > end > end > > module R1 > refine C do > def foo > p R1 > super > end > end > end > > using R1 # 1 > > module R2 > using R1 # 2 > > refine C do > # using R1 # 3 > > def bar > C.new.foo > end > end > end > > using R2 > > C.new.bar > ``` > > Without `using R1 # 3`, `C#foo` was called in `R2::C#bar`. > > By `using R1 #1` and `#2`, we declared that this lexical scope should use R1. However, it seems that this declaration is ignored. > > Is it an intentional behavior? It's intentional. In refine blocks of a module X, all refinements defined in X are activated, and other refinements previously activated are deactivated. ---------------------------------------- Bug #11246: refine block doesn't respect "lexical" refinement information https://bugs.ruby-lang.org/issues/11246#change-53102 * Author: Koichi Sasada * Status: Rejected * Priority: Normal * Assignee: Shugo Maeda * ruby -v: ruby 2.3dev * Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN ---------------------------------------- The following program making two refinements refine class C. ```ruby class C def foo p C end end module R1 refine C do def foo p R1 super end end end using R1 # 1 module R2 using R1 # 2 refine C do # using R1 # 3 def bar C.new.foo end end end using R2 C.new.bar ``` Without `using R1 # 3`, `C#foo` was called in `R2::C#bar`. By `using R1 #1` and `#2`, we declared that this lexical scope should use R1. However, it seems that this declaration is ignored. Is it an intentional behavior? -- https://bugs.ruby-lang.org/