Given the code:
method pod_block:sym<delimited>($/) {
my $name := $*ST.add_constant('Str', 'str', $<type>.Str);
my $past := $*ST.add_constant(
'Pod__Block__Named', 'type_new',
:name($name<compile_time_value>),
);
say(" The block from ",
$/.from, "-", $/.to,
" named '", $<type>.Str,
"' became ", $past<compile_time_value>);
make $past<compile_time_value>;
}
I get the output:
The block from 9-41 named 'pod' became Pod__Block__Named<16727264>
The block from 42-84 named 'otherpod' became Pod__Block__Named<16727264>
(Note the identical IDs)
Looks like add_constant is confused, and assumes the object are identical, thus serializing only the first one and then linking the other one to it. Note that it's a patched SymbolTable, commit https://github.com/rakudo/rakudo/commit/e258ef5a. I hope it's related to the patch and not to SymbolTable per se, but jnthn didn't notice anything broken in it (yet).