Created
July 8, 2012 16:03
-
-
Save anonymous/3071483 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
pmichaud@kiwi:~/p6/rakudo$ cat y | |
class MyType { | |
method postcircumfix:<( )>(MyType:U: $value) { | |
say "coerced $value"; | |
} | |
} | |
say "MyType(3) = {MyType(3)}"; | |
sub xyz($x as MyType) { say $x } | |
xyz(3); | |
pmichaud@kiwi:~/p6/rakudo$ ./perl6 y | |
coerced 3 | |
MyType(3) = True | |
Unable to coerce value for '$x' from Int to MyType; no coercion method defined | |
in sub xyz at y:9 | |
in block <anon> at y:11 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment