Skip to content

Instantly share code, notes, and snippets.

Created April 27, 2012 17:58
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 anonymous/2511334 to your computer and use it in GitHub Desktop.
Save anonymous/2511334 to your computer and use it in GitHub Desktop.
empty capture
use v6;
sub somesub(){
say "i haz a sub";
};
class Foo {
has @.a is rw;
method add(&c){ @.a.push(&c) }
method postcircumfix:<( )>($self: |$c) {
#since i stripped self into $self, the capture should be empty
@.a>>.(|$c)
}
}
my $foo = Foo.new;
$foo.add(&somesub);
$foo();
#> Too many positional parameters passed; got 1 but expected 0
#> in sub somesub at empty_capture.p6:3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment