HaloO,
Yuval Kogman wrote:
Today on #perl6 I complained about the fact that this is always
inelegant:
if ($condition) { pre }
unconditional midsection;
if ($condition) { post }
I'm not sure if you would considered closure traits as equally
inelegant but what are PRE and POST or BEGIN and LEAVE for if
not your case?
So we have:
{
my $condition = ENTER { calculate_condition };
LEAVE { if $condition { cleanup_commit_or_somesuch; }
unconditional midsection;
}
Well and there are more convenient forms mentioned in S04:
{
my $condition will enter { pre }
will leave { post }
will undo { undo pre }
= calculate_condition();
unconditional part;
}
--
$TSa.greeting := "HaloO"; # mind the echo!