From: mike@oobak.org
To: ruby-core@ruby-lang.org
Subject: [ruby-core:71532] [Ruby trunk - Bug #11705] [Open] Namespace resolution in nested modules with short syntax
Date: Tue, 17 Nov 2015 23:28:36 +0000 [thread overview]
Message-ID: <redmine.issue-11705.20151117232835.4589fc3e5d644d8c@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-11705.20151117232835@ruby-lang.org
Issue #11705 has been reported by Mike Pastore.
----------------------------------------
Bug #11705: Namespace resolution in nested modules with short syntax
https://bugs.ruby-lang.org/issues/11705
* Author: Mike Pastore
* Status: Open
* Priority: Normal
* Assignee:
* ruby -v:
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
Given the following definition:
~~~
module Foo
class Qux
def self.hello
'Hello, world!'
end
end
end
~~~
Namespace resolution at a later time works differently when you have nested modules, e.g.
~~~
module Foo
module Bar
# Can't find Foo::Bar::Qux, so "goes up" to find Foo::Qux.
p Qux.hello # < "Hello, world!"
end
end
~~~
vs. the short syntax, e.g.
~~~
module Foo::Bar
# Can't find Foo::Bar::Qux, but doesn't "go up" to find Foo::Qux.
p Qux.hello # < in `<module:Bar>': uninitialized constant Foo::Bar::Qux (NameError)
end
~~~
Is this intentional and/or expected?
--
https://bugs.ruby-lang.org/
next parent reply other threads:[~2015-11-17 22:58 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <redmine.issue-11705.20151117232835@ruby-lang.org>
2015-11-17 23:28 ` mike [this message]
2015-12-18 8:30 ` [ruby-core:72359] [Ruby trunk - Bug #11705] [Rejected] Namespace resolution in nested modules with short syntax shugo
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-11705.20151117232835.4589fc3e5d644d8c@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).