Created
June 21, 2016 21:06
-
-
Save rjbs/1b6673ab637396972d95e9c1294be716 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!perl6 | |
# | |
use v6; | |
my class HelloWorldFactory { | |
subset NonEmpty of Str where .chars > 0; | |
has NonEmpty $.greeting; | |
has NonEmpty $.target; | |
sub infix:<๐> { | |
constant joiner = "\c[COMMA]\c[NO-BREAK SPACE]"; | |
[~] $^greeting, joiner, $^target | |
} | |
method hello-world($target = self.target --> NonEmpty) { | |
$.greeting ๐ $target | |
} | |
} | |
HelloWorldFactory.new(greeting => "Hello", target => "World") | |
.hello-world | |
.say; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment