Skip to content

Instantly share code, notes, and snippets.

@gfldex
Created July 31, 2020 16:30
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 gfldex/f577d9816af2b6b2dc2e84e92a3ace10 to your computer and use it in GitHub Desktop.
Save gfldex/f577d9816af2b6b2dc2e84e92a3ace10 to your computer and use it in GitHub Desktop.
use v6.d;
class C {
has $.foo;
has $.bar;
method m {
my %h = foo => 1, bar => 2;
for self.^attributes {
.set_value(self, %h{.name.subst(/^'$!'/, '')})
}
self
}
}
dd C.new.m;
# LEAVE slurp($*PROGRAM).say;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment