I made a pasta error. The final example should be:
package Foo { package Bar { our sub foo {} }};
package Foo::Bar { our sub foo {} };
#!> Redeclaration of routine foo (already defined in package Foo::Bar)
On Sat, Oct 10, 2015 at 11:41 PM, perl6 via RT <[email protected]
> wrote:
> Greetings,
>
> This message has been automatically generated in response to the
> creation of a trouble ticket regarding:
> "[BUG] custom declarator examples in S12 don't work (nested
> packages)",
> a summary of which appears below.
>
> There is no need to reply to this message right now. Your ticket has been
> assigned an ID of [perl #126317].
>
> Please include the string:
>
> [perl #126317]
>
> in the subject line of all future correspondence about this issue. To do
> so,
> you may reply to this message.
>
> Thank you,
> [email protected]
>
> -------------------------------------------------------------------------
> http://design.perl6.org/S12.html#Custom_Meta-objects
>
> my module EXPORTHOW::DECLARE { }
> EXPORTHOW::DECLARE<controller> = ControllerHOW;
>
> This currently throws "cannot modify an immuteable
> EXPORTHOW::DECLARE". But if we fix that there is another problem:
>
> my package EXPORTHOW::DECLARE {
> OUR::<controller> := Metamodel::ClassHOW;
> };
>
> doesn't work either. The thing that works is:
>
> my package EXPORTHOW {
> package DECLARE {
> OUR::<controller> := Metamodel::ClassHOW;
> }
> }
>
> Not sure if the docs are wrong or the implementation though the
> following problem seems linked:
>
> package Foo { package Bar { our sub foo {} }};
> package Foo::Bar { our sub bar {} };
> say Foo::Bar::<&foo>.package; #-> (Bar)
> say Foo::Bar::<&bar>.package; #-> (Foo::Bar)
>
> But if you then try in a new interpreter:
>
> package Foo { package Bar { our sub foo {} }};
> package Foo::Bar { our sub bar {} };
> #!> Redeclaration of routine foo (already defined in package Foo::Bar)
>
> TL;DR rakudo is not sure which namespace nested packages belong to
>
>