On Sun Apr 10 08:20:19 2016, raiph wrote:
> What I did
> ==========
>
> package foo {}
> enum foo <a>
>
> What I expected
> ===============
>
> The same redeclaration error I get when I write:
>
> enum foo <a>;
> package foo {}
>
> # Redeclaration of symbol foo
>
> What I got
> ==========
>
> No error.
>
This is correct, and intended, behavior. A package serves as a "stub" that can
be stolen by another declaration later. For example:
> module Foo::Bar { }
> say Foo::Bar.HOW.^name
Perl6::Metamodel::ModuleHOW
> say Foo.HOW.^name
Perl6::Metamodel::PackageHOW
> class Foo { }
> say Foo.HOW.^name
Perl6::Metamodel::ClassHOW
If a package couldn't be stolen in that way, then you could never declare a
class Foo { } after a class Foo::Bar { } had been declared. This is largely why
package exists; if it did exactly the same as module, then there'd be no reason
for us to have it. :-)
Thanks,
Jonathan