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 5C1C817DEF17 for ; Fri, 10 Apr 2015 17:26:22 +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 8ED1FB5D8E0 for ; Fri, 10 Apr 2015 17:36:45 +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 9334C97A834 for ; Fri, 10 Apr 2015 17:36:47 +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 SXaG9RPXSEgL for ; Fri, 10 Apr 2015 17:36:47 +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 7145B97A826 for ; Fri, 10 Apr 2015 17:36:47 +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 647B7952446 for ; Fri, 10 Apr 2015 17:36:45 +0900 (JST) Received: from [221.186.184.76] (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 64E9D12047A; Fri, 10 Apr 2015 17:36:43 +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 7AE2D12043A for ; Fri, 10 Apr 2015 17:36:39 +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=jOm2b3g75TdXCNH+DMGA+rluSlI=; b=UGyE/9PUdRjulxfvbW UPilENZDeZ0bGynFWvZUiojCwtvLXHFVPSKoNJwGy39YJa9jyiblf+VIBu62GbEy vIQFSD8f/zMHmvC47VcEGQZy9jkzGz9UYr0L5n31zrj27sn5cfT62OFRC3r3OkJs hQqm5TudyWXXzbZIDyhTjgbW4= Received: by filter0327p1mdw1.sendgrid.net with SMTP id filter0327p1mdw1.24636.55278B922 2015-04-10 08:36:34.785535265 +0000 UTC Received: from herokuapp.com (ec2-54-157-194-151.compute-1.amazonaws.com [54.157.194.151]) by ismtpd-046 (SG) with ESMTP id 14ca2793580.76d1.b653 for ; Fri, 10 Apr 2015 08:36:34 +0000 (UTC) Date: Fri, 10 Apr 2015 08:36:34 +0000 From: nobu@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: 43233 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 11055 X-Redmine-Issue-Author: nobu X-Redmine-Issue-Assignee: matz X-Redmine-Sender: nobu X-Mailer: Redmine X-Redmine-Host: bugs.ruby-lang.org X-Redmine-Site: Ruby Issue Tracking System X-Auto-Response-Suppress: OOF Auto-Submitted: auto-generated X-SG-EID: ync6xU2WACa70kv/Ymy4QrNMhiuLXJG8OTL2vJD1yS6kZSsa5yjI4a20zjEcPh3/fINzkS4xs5BI3W FhszhwrCal7i6K2FmRkg/kpozUjph29Bx8gENX5r1rkOOO4q62q4iEpgaPBaGract4W/Fu0V13Kf/k AeeuYSCINfUPfT4= X-ML-Name: ruby-core X-Mail-Count: 68831 Subject: [ruby-core:68831] [Ruby trunk - Bug #11055] [Assigned] autoload resets private_constant 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 #11055 has been reported by Nobuyoshi Nakada. ---------------------------------------- Bug #11055: autoload resets private_constant https://bugs.ruby-lang.org/issues/11055 * Author: Nobuyoshi Nakada * Status: Assigned * Priority: Normal * Assignee: Yukihiro Matsumoto * ruby -v: 50203 * Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN ---------------------------------------- Is this behavior intentional? Suppose the following file: ~~~ $ cat a/b.rb class A; B = 1; end ~~~ This causes `NameError`. ~~~ $ ruby -I. -e 'class A;autoload :B, "a/b.rb"; private_constant :B; end' -e 'p A::B' -e:2:in `
': private constant A::B referenced (NameError) ~~~ But after it got loaded, `A::B` becomes public. ~~~ $ ruby -I. -e 'class A;autoload :B, "a/b.rb"; private_constant :B; B; end' -e 'p A::B' 1 ~~~ -- https://bugs.ruby-lang.org/