On Mon, 30 Apr 2001, Yukihiro Matsumoto wrote:
> Because it's kinda hard to handle nested constants like "Foo::Bar"
> from C level.  Unlike Perl, "Foo::Bar" is not a single package name.
> It retrieve the value of constant Foo, then the value of constant Bar
> defined within Foo (assuming Foo is a class or module).  Constant
> "Foo" might not be a class nor module, might not be defined yet, etc.

In Perl, "Foo::Bar" is not a single package name either:

package Foo::Bar; sub baz { print "hello\n"; }
$::{"Foo::"}{"Bar::"}{"baz"}->()
	#==> hello

packages are special typeglobs whose names end with a "::". The difference
ends there.

$::{"Blah::"} = \*{$::{"Foo::"}{"Bar::"}};
$::{"Blah::"}{"baz"}->();
	#==> hello
Blah::baz()
	#==> hello

This works too; you can alias package names in Perl, although this is very
seldom used and really not as easy as in Ruby. You can also create loops
like Ruby's Object::Object::Object...

matju