Skip to content

Instantly share code, notes, and snippets.

Created June 10, 2011 11:14
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/1018633 to your computer and use it in GitHub Desktop.
Save anonymous/1018633 to your computer and use it in GitHub Desktop.
my &return = -> \$parcel {
Q:PIR {
.include 'except_types.pasm'
.include 'except_severity.pasm'
.local pmc ex
ex = root_new ['parrot';'Exception']
$P0 = box .CONTROL_RETURN
setattribute ex, 'type', $P0
$P0 = find_lex '$parcel'
setattribute ex, 'payload', $P0
$P0 = box .EXCEPT_NORMAL
setattribute ex, 'severity', $P0
throw ex
};
0;
};
sub abc($x) {
if $x { return 'true' }
'false'
}
say abc(1);
say abc(0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment