Will the proposed new want operator make writing wrapper
subroutines which recreate their own context for the
subroutine they are wrapping harder?
For example how would the following perl 5 subroutine
be rewritten under perl 6 with the want operator?
sub wrapper {
my (@ret,$ret);
lock_resource();
if (wantarray) {
@ret = &wrapped;
} elsif (defined wantarray) {
$ret = &wrapped;
} else {
&wrapped;
}
unlock_resource();
if (wantarray) {
return @ret;
} elsif (defined wantarray) {
return $ret;
} else {
return;
}
}
Presumably wrapped() currently does one of 3 different
things according to the value of wantarray but might be
enhanced to do one of up to 21 different things according
to the value of want.
William