Skip to content

Instantly share code, notes, and snippets.

View bronco-creek's full-sized avatar

Cole Keirsey bronco-creek

  • Boulder, Colorado, USA
View GitHub Profile
@bronco-creek
bronco-creek / gist:dbd1bb1acfc2fcfb0d1b8535737c389d
Created March 20, 2020 17:00
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);