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 7EC3C1960014 for ; Tue, 30 Jun 2015 12:53:32 +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 A9667B5D93C for ; Tue, 30 Jun 2015 13:18:48 +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 2A5AF97A847 for ; Tue, 30 Jun 2015 13:18:50 +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 kCMOHYQX8Kq0 for ; Tue, 30 Jun 2015 13:18:50 +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 E238097A826 for ; Tue, 30 Jun 2015 13:18:49 +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 4461E952439 for ; Tue, 30 Jun 2015 13:18:48 +0900 (JST) Received: from [221.186.184.76] (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id BD032120512; Tue, 30 Jun 2015 13:18:46 +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 F2BBF1204F5 for ; Tue, 30 Jun 2015 13:18:43 +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=R7ImOS6pSrjMSMdRw8JHh+fPIeg=; b=tTHzLcktKwJcTpPu/j k8uhwkmfetqJEAjNzCMJV3D8Jfr/aBxpFnsece+PA/snP8VEl9rlJ7R5+B0vDSCR EX8xgsvRXMYCAC31AI9WH0yMlLRfCSGHh8Yl4plOlBbAUSTz9EU5sCHrz5hZgfSf EfA54jnQM8DasuKjcakAUQYto= Received: by filter0555p1mdw1.sendgrid.net with SMTP id filter0555p1mdw1.17133.5592189F2 2015-06-30 04:18:40.947337807 +0000 UTC Received: from herokuapp.com (ec2-54-163-6-103.compute-1.amazonaws.com [54.163.6.103]) by ismtpd-032 (SG) with ESMTP id 14e42b03496.52c.26c28a Tue, 30 Jun 2015 04:18:40 +0000 (UTC) Date: Tue, 30 Jun 2015 04:18:40 +0000 From: usa@garbagecollect.jp 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: 44400 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 10967 X-Redmine-Issue-Author: spastorino X-Redmine-Sender: usa 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/Ymy4QrNMhiuLXJG8OTL2vJD1yS47Wl2DJ5m5dLT5dXlYsQ4G0qvPVp59sHFTu2 2xSfPUihw4XSL1zDyLVhO0D1ix+FkbwiUuAv4tb/Hbw+QXYRniLtr4J9JW8jpUYdlVvSoQitZYJXWb Ol78mNNYkl9MRjcjQcWN45677tOuwmoJREt4 X-ML-Name: ruby-core X-Mail-Count: 69804 Subject: [ruby-core:69804] [Ruby trunk - Bug #10967] Is "warning: private attribute?" wrong? 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 #10967 has been updated by Usaku NAKAMURA. Backport changed from 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN to 2.0.0: WONTFIX, 2.1: REQUIRED, 2.2: REQUIRED ---------------------------------------- Bug #10967: Is "warning: private attribute?" wrong? https://bugs.ruby-lang.org/issues/10967#change-53200 * Author: Santiago Pastorino * Status: Closed * Priority: Normal * Assignee: * ruby -v: ruby 2.3.0dev (2015-03-01 trunk 49796) [x86_64-darwin14] * Backport: 2.0.0: WONTFIX, 2.1: REQUIRED, 2.2: REQUIRED ---------------------------------------- The following code ... ```ruby class Y def initialize @x = "ZOMG" end def print_x puts x end private attr_reader :x end Y.new.print_x ``` outputs ... ``` test.rb:12: warning: private attribute? ``` I tend to think this warning is wrong, I was surprised by https://github.com/rack/rack/pull/811 and I think this is a completely valid use case. Also this code ... ```ruby class Y def initialize @x = "ZOMG" end def print_x puts x end def assign_x self.x = "ZOMG ZOMG" end private attr_accessor :x end y = Y.new y.assign_x y.print_x ``` Works fine with warnings also. So a private writer works ok when the receiver is `self` because Ruby has a special case for it, this make me think that private writers were thought to be used. So ... am I wrong thinking that the warning should be removed or the self special case shouldn't work and be removed from Ruby code?. It doesn't make sense to me to have both things. -- https://bugs.ruby-lang.org/