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 CED9719803F8 for ; Fri, 14 Aug 2015 15:11:03 +0900 (JST) Received: from funfun.nagaokaut.ac.jp (smtp.nagaokaut.ac.jp [133.44.2.201]) by kankan.nagaokaut.ac.jp (Postfix) with ESMTP id D57C4B5D8C9 for ; Fri, 14 Aug 2015 15:46:03 +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 B452897A827 for ; Fri, 14 Aug 2015 15:46:05 +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 x45YfdfrYRzw for ; Fri, 14 Aug 2015 15:46:05 +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 7833C97A820 for ; Fri, 14 Aug 2015 15:46:05 +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 89194952439 for ; Fri, 14 Aug 2015 15:46:02 +0900 (JST) Received: from [221.186.184.76] (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 8D2C512043A; Fri, 14 Aug 2015 15:46:01 +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 B4BD312003B for ; Fri, 14 Aug 2015 15:45:54 +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=aoPsz9UOAkRnNIzDLN/kpWcUm54=; b=KZpMWfn17+WvkJ5HA5 cIQGs9p1DpG+iTBPAY1lIrLcFCLqiD7tnWz5EwAF4wiohnq9aSwcPA+2l+Pab2s7 D04qcGe4ePVrbegy6aYaXlp793x3KCofaU2IusGEKaa46FER5zWfGmfHHcGizxmX Me/Bxy4g3t2CvdCiG4DS8u/cI= Received: by filter0418p1mdw1.sendgrid.net with SMTP id filter0418p1mdw1.21400.55CD8E9FD 2015-08-14 06:45:51.657160733 +0000 UTC Received: from herokuapp.com (ec2-54-147-231-81.compute-1.amazonaws.com [54.147.231.81]) by ismtpd0005p1iad1.sendgrid.net (SG) with ESMTP id rjic0YsOTi--ighBTqqRzg Fri, 14 Aug 2015 06:45:51 +0000 (UTC) Date: Fri, 14 Aug 2015 06:45:51 +0000 From: nagachika00@gmail.com 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: 44986 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 10967 X-Redmine-Issue-Author: spastorino X-Redmine-Sender: nagachika 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/Ymy4QrNMhiuLXJG8OTL2vJD1yS6XuVtlTgsDaK0g5xTHFiqWu2zntorgD3+NC+ 3BBImpXycSgxOFjFc5lQAZQCcOpSZ5Y/ZSP8N9Yr7OMrbNBwoKRC0Ji2MauYR/SrIKuPPrxC1AR3v2 wvD20DIzoQM1adHVnUfMv6UHcLBmu9FGIKe2 X-ML-Name: ruby-core X-Mail-Count: 70383 Subject: [ruby-core:70383] [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 Tomoyuki Chikanaga. Backport changed from 2.0.0: WONTFIX, 2.1: REQUIRED, 2.2: REQUIRED to 2.0.0: WONTFIX, 2.1: REQUIRED, 2.2: WONTFIX Hmm, I don't know it's a bug fix or a spec change, but I think it's a trivial issue. I decided to not to backport to 2.2. Please notice if any objections. ---------------------------------------- Bug #10967: Is "warning: private attribute?" wrong? https://bugs.ruby-lang.org/issues/10967#change-53786 * 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: WONTFIX ---------------------------------------- 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/