Skip to content

Instantly share code, notes, and snippets.

@ronaldxs
Created March 24, 2018 17:33
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 ronaldxs/c4a992739642824cf7da97509ddf9b58 to your computer and use it in GitHub Desktop.
Save ronaldxs/c4a992739642824cf7da97509ddf9b58 to your computer and use it in GitHub Desktop.
Shouldn't there be an auto-generated accessor here
use v6;
class C { has $.a = 3;
multi method a(Int $i) {
$!a = $i * 2
}
}
my $o = C.new;
$o.a(4);
say 'mutated attribute';
say $o.a;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment