Subject: | Support lexically-scoped slot variables |
It's common in packages to provide a "per-sub" visible lexical by syntax like:
{
my $thing;
sub get_thing { return $thing //= make_thing() }
}
We could support similar syntax of slot visibility by making slots invisible after their block expires:
{
has $thing;
method thing { return $thing //= make_thing() }
}
--
Paul Evans