`Foo::Bar::<$quux>` is basically short for `::Foo::Bar::('$quux')` (except
the former is looked up at compile time)
So the way to do this is:
my $bar = 'Bar';
::Foo::( $bar ~ '::$quux' )
or
::Foo::($bar)::('$quux')
Note that the leading `::` are necessary for dynamic lookups. (Where the
name is in a variable)
On Sun, Sep 30, 2018 at 7:27 AM Richard Hogaboom <[email protected]>
wrote:
> This does not compile; I think it should:
>
> use v6;
>
> class Foo {
> class Bar {
> our $quux = 42;
> }
> }
>
> say $Foo::Bar::quux; # works - 42
> say Foo::Bar::<$quux>; # works - 42
> my $bar = 'Bar';
> say $Foo::($bar)::quux; # works - 42
>
> # shouldn't this work too?
> say Foo::($bar)::<$quux>; # nope - won't compile
>
> # ===SORRY!=== Error while compiling
> /home/hogaboom/hogaboom/Perl6/p6ex/./p6test.p6
> # Combination of indirect name lookup and call not supported
> # at /home/hogaboom/hogaboom/Perl6/p6ex/./p6test.p6:16
> # ------> say Foo::($bar)::⏏<$quux>; # nope
> # expecting any of:
> # argument list
>
> # See https://docs.perl6.org/language/packages
> # and look at the first two sections: 'Names' and 'Package-qualified names'
>
> --
>
> rahogaboom
>