From: nobu@ruby-lang.org
To: ruby-core@ruby-lang.org
Subject: [ruby-core:68831] [Ruby trunk - Bug #11055] [Assigned] autoload resets private_constant
Date: Fri, 10 Apr 2015 08:36:34 +0000 [thread overview]
Message-ID: <redmine.issue-11055.20150410083633.907f061e56fbfb02@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-11055.20150410083633@ruby-lang.org
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 `<main>': 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/
next parent reply other threads:[~2015-04-10 8:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <redmine.issue-11055.20150410083633@ruby-lang.org>
2015-04-10 8:36 ` nobu [this message]
2019-08-12 4:02 ` [ruby-core:94299] [Ruby master Bug#11055] autoload resets private_constant merch-redmine
2019-10-17 5:21 ` [ruby-core:95379] " matz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.ruby-lang.org/en/community/mailing-lists/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=redmine.issue-11055.20150410083633.907f061e56fbfb02@ruby-lang.org \
--to=ruby-core@ruby-lang.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).