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 2D26B1BA012C for ; Fri, 19 May 2017 15:49:31 +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 86F0AB5D839 for ; Fri, 19 May 2017 16:35:02 +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 1853F18CC829 for ; Fri, 19 May 2017 16:35:03 +0900 (JST) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id D8C37120739; Fri, 19 May 2017 16:35:02 +0900 (JST) X-Original-To: ruby-core@ruby-lang.org Delivered-To: ruby-core@ruby-lang.org Received: from o1678916x28.outbound-mail.sendgrid.net (o1678916x28.outbound-mail.sendgrid.net [167.89.16.28]) by neon.ruby-lang.org (Postfix) with ESMTPS id 2B51112072A for ; Fri, 19 May 2017 16:34:57 +0900 (JST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=sendgrid.me; h=from:to:references:subject:mime-version:content-type:content-transfer-encoding:list-id; s=smtpapi; bh=TSWHlALoN28fz0jT80wD6DAvmRM=; b=b3H0EQHi3D/tCSQuMl gGsO6/jntZYbcUKohYJw0tQWD7vgG3SQqiDdcryhSdX99axDZ3Sso6jtCa4eTrwk uVqnoPxHNAdfgzusi4VgVk909wY9msojichHX6G/q4vg5YCyuyf99t/q1ti0aE28 KC6PXD6PDeig3bmMdTCZf0j+s= Received: by filter0498p1mdw1.sendgrid.net with SMTP id filter0498p1mdw1-15851-591EA01F-2E 2017-05-19 07:34:55.393359618 +0000 UTC Received: from herokuapp.com (ec2-54-197-158-92.compute-1.amazonaws.com [54.197.158.92]) by ismtpd0006p1iad1.sendgrid.net (SG) with ESMTP id BKVCU58VSI-KFoKPJpj5Cw Fri, 19 May 2017 07:34:55.151 +0000 (UTC) Date: Fri, 19 May 2017 07:34:55 +0000 From: ko1@atdot.net To: ruby-core@ruby-lang.org Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 56282 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 13249 X-Redmine-Issue-Author: abotalov X-Redmine-Issue-Assignee: ko1 X-Redmine-Sender: ko1 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/Ymy4QrNMhiuLXJG8OTL2vJD1yS7aApg4vZjhjsVzOBa35qNbCJy8oGO7zStZaR NC33Sun0O8nRg6Pe+25gylk/ltz+G5CK95UUS3NBV1dKGWYdS8QPiVGyhdz6sfdRyTXu6/jQ6t1TKp N53IpAKXrCoklNYOAG8LpsvgiYj7i4GmXsak X-ML-Name: ruby-core X-Mail-Count: 81261 Subject: [ruby-core:81261] [Ruby trunk Bug#13249] Access modifiers don't have an effect inside class methods in Ruby >= 2.3 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 #13249 has been updated by ko1 (Koichi Sasada). I will insert warning. I will not change the current behavior. ---------------------------------------- Bug #13249: Access modifiers don't have an effect inside class methods in Ruby >= 2.3 https://bugs.ruby-lang.org/issues/13249#change-64926 * Author: abotalov (Andrei Botalov) * Status: Assigned * Priority: Normal * Assignee: ko1 (Koichi Sasada) * Target version: * ruby -v: 2.3.0, 2.4.0 * Backport: 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN ---------------------------------------- Simple example: ~~~ ruby class C def self.foo private def bar end end end C.foo C.new.bar ~~~ This code runs fine on Ruby 2.3 and Ruby 2.4. It raises NoMethodError on Ruby 2.2 and prior versions. I would expect an error to be raised. Here is some code that actually uses private access modifier inside a class method - https://github.com/evolve75/RubyTree/blob/db48c35b0a3b96e4da473b095cc00e454d8a9996/lib/tree/utils/camel_case_method_handler.rb#L60 By the way, this code raises an error as expected on Ruby 2.3 and Ruby 2.4: ~~~ ruby class C def self.foo private def bar end end end C.foo C.new.bar # NoMethodError: private method `bar' called ~~~ -- https://bugs.ruby-lang.org/