Skip to content

Instantly share code, notes, and snippets.

Created January 23, 2012 21:34
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 anonymous/1665643 to your computer and use it in GitHub Desktop.
Save anonymous/1665643 to your computer and use it in GitHub Desktop.
Method 'a' not found for invocant of class 'Mu'
role MyAtPos[$s,$i] {
method at_pos($j) {
Proxy.new:
FETCH => method {$s.a[$i][$j]},
STORE => method ($p) {
$s.h{ $s.a[$i][$j] } = 0;
$s.h{ $p } = [$i, $j];
$s.a[$i][$j]=$p;
};
}
}
method at_pos(Board $s: $i) {
Proxy.new:
FETCH => method {
$s.a[$i] does MyAtPos[$s,$i];
},
STORE => method ($p) {die "Err: Can't assign to an entire row"};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment