my $varname = 'head';
#1 say $.::($varname);
#2 say $::('.' ~ $varname);
#3 something else
I'd say #1 is easiest to grok, insofar as it identifies at compile time
which namespace you're searching at run time. #2 is rather strange,
but conceivably gives you greater flexibility, at the expense of making
certain leading characters illegal in whatever the default search
space is. That's probably bad. If we pattern it after MY::<$foo>
and OUR::<$foo> and GLOBAL::<$foo> and COMPILING::<$foo>, then #3
might look like this:
SELF::{$varname}
where $varname probably includes the sigil but maybe not the twigil.
Though in this particular case, since $.foo is always virtual anyway,
you could always just say
self.$varname
to mean the same thing. Presumably you can even get at private
variables using indirect private method syntax:
self!$varname
Larry