Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bronco-creek/dbd1bb1acfc2fcfb0d1b8535737c389d to your computer and use it in GitHub Desktop.
Save bronco-creek/dbd1bb1acfc2fcfb0d1b8535737c389d to your computer and use it in GitHub Desktop.
This Raku code demonstrates a behavior that I don't understand. When the variable $x and $y are assigned to values in hashes, the hashes behave as I'd expect. But when those hashes are pushed into an array, it looks like $x and $y are bound to their slots in the hashes rather than assigned. I don't get it...
my $x = 33;
my $y = 33;
my @space;
my %coords = 'x', $x, 'y', $y;
%coords.say;
@space.push(%coords);
$x = 42;
%coords = 'x', $x, 'y', $y;
%coords.say;
@space.push(%coords);
put "From the array";
for @space { $_.say }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment