Created
August 25, 2022 23:30
-
-
Save gfldex/337fb1f3d8a8bcec0ccf4556124ff2b1 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
use v6.*; | |
class Type is Int { } | |
subset Even of Type where * %% 2; | |
Type.^add_method('COERCE', my method COERCE(|) { | |
my Even $retval = 42 | |
}); | |
sub foo(Even() $_) { .&dd } | |
foo ‘answer’; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment