I played with Interpolation in names . I was more interested in this colon syntax function to turn a variable into a pair where the identifier is the key.
my %Hamadryas = map { slip $_, 0 }, < februa honorina velutina >; { my $pair = :%Hamadryas; say $pair;
But, just for a giggle, I also wanted to try with variable name interpolation. I know this is stupid, because if I know the name, I don't need the colon syntax to get it. But I also thought that it should work by chance:
{ my $name = 'Hamadryas';
Why is the syntax :%::($name) not working? It is a question of when the parser decides that it does not parse what it wants to understand. I decided that he would see : and begin processing the colon pair, and then see % and find out that it has a hash, although there :: after % .
Is there a way to make it work with grammar tricks and mutations?
perl6
brian d foy
source share