Skip to content

Instantly share code, notes, and snippets.

@ufobat
Created April 14, 2016 12:29
Show Gist options
  • Save ufobat/5d212eed9e7835e75ee6b7b85a5e6f98 to your computer and use it in GitHub Desktop.
Save ufobat/5d212eed9e7835e75ee6b7b85a5e6f98 to your computer and use it in GitHub Desktop.
martin@thetis ~/.workspace/p6/Creator
% cat CreatorOfHuman.pm6
use v6;
use Human;
role CreatorOfHuman {
method create_human(Str $name) {
return Human.new(:$name);
}
}
martin@thetis ~/.workspace/p6/Creator
% cat God.pm6
use v6;
use CreatorOfHuman;
class God is CreatorOfHuman {
has $.might = 1;
}
martin@thetis ~/.workspace/p6/Creator
% cat Human.pm6
use v6;
use CreatorOfHuman;
class Human is CreatorOfHuman {
has $.name = "Jane Doe";
}
martin@thetis ~/.workspace/p6/Creator
% perl6 -I. -e 'use God; my $god = God.new'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment