Skip to content

Instantly share code, notes, and snippets.

@uasi
Created May 8, 2010 06:44
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 uasi/394411 to your computer and use it in GitHub Desktop.
Save uasi/394411 to your computer and use it in GitHub Desktop.
use v6;
use MONKEY_TYPING;
class C {}
role R {
method perl() { 'perl' }
method foo() { 'foo' }
}
augment class C does R {}
augment class Array does R {}
augment class Str does R {}
say C ~~ R; # 1
say C.new.perl; # perl
say C.new.foo; # foo
say [] ~~ R; # 1
say [].perl; # []
say [].foo; # foo
say '' ~~ R; # 1
say ''.perl; # ""
# say ''.foo; # ('foo' not found)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment