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
| my $cl = { say $/ }; | |
| class C { | |
| proto foo(|) {*}; | |
| multi method foo(C:U: $cl, $) { | |
| return self.foo($cl) | |
| } | |
| multi method foo(C:U: $cl) { | |
| "b" ~~ /./; my $cds := nqp::getlexcaller('$/'); $cds = $/; $cl() | |
| } | |
| } | |
| C.foo($cl, 1); # prints Nil | |
| say "=" x 10; | |
| proto bar(|) {*}; | |
| multi bar($cl, $) { | |
| bar($cl) | |
| } | |
| multi bar($cl) { | |
| "bar" ~~ /./; my $cds := nqp::getlexcaller('$/'); $cds = $/; $cl() | |
| } | |
| bar($cl, 1); # prints 「b」 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment