Created
March 21, 2017 09:48
-
-
Save dakkar/fa26e2b816f92d494b79fb89e891fcd0 to your computer and use it in GitHub Desktop.
This file contains 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.c; | |
class Thing { | |
method blah($val=1) { 15+$val } | |
} | |
class Thunk { | |
has $.maker; | |
method FALLBACK(Any:D $invocant is rw: $name, |c) { | |
my $thing = $invocant.maker.(); | |
$invocant = $thing; | |
$invocant."$name"(|c); | |
} | |
} | |
my $t = Thunk.new(:maker({ Thing.new() })); | |
say $t.perl; | |
say $t.blah(15); | |
say $t.perl; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment