#
# example from https://docs.perl6.org/language/packages
#
# from documentation under Package-qualified names:
#
# "Sometimes it's clearer to keep the sigil with the variable name, so an alternate way to write this is:
# Foo::Bar::<$quux>
# (This does not work with the &zape variable) The name is resolved at compile time because the variable name is a constant."
#
# So, I tried &zape, which gives the expected error output. However, it suggests possible corrections, which I tried. # say Foo::Bar::<&zape>; should also fail, but compiles, executes, does nothing, gives strange msg
#

use v6;

class Foo {
    class Bar {
        our &zape = { "zipi" };
    }
}

say Foo::Bar::zape;  # works - prints 'zipi'

# this should not compile - see error msg below
#say Foo::Bar::&zape;  # Nope - it does not compile - correct

# ===SORRY!=== Error while compiling /home/hogaboom/hogaboom/Perl6/p6ex/./p6Packages.p6 # Malformed lookup of ::&zape; please use ::('&zape'), ::{'&zape'}, or ::<&zape>
# at /home/hogaboom/hogaboom/Perl6/p6ex/./p6Packages.p6:12
# ------> say Foo::Bar⏏::&zape;  # Nope - not compile - correct

# this also should not compile
say Foo::Bar::<&zape>;  # compiles - executes - does nothing useful - gives following strange output say Foo::Bar::{'&zape'};  # compiles - executes - does nothing useful - same strange output
#say Foo::Bar::('&zape');  # does not compile

# -> ;; $_? is raw { #`(Block|62717656) ... }
# what does this output mean?

say "end";  # prints 'end'

--
rahogaboom

Reply via email to