On Fri, Apr 29, 2005 at 08:14:38AM -0400, Butler, Gerald wrote:
:
: Isn't there something like:
:
: {
: my $s does LEAVE { destroy $s } = new CoolClass;
: # ... do stuff that may throw ...
: }
:
: Or something like that?
Yes,it's
my $s will leave { destroy $s } = new CoolClass;
and then it only destroyes if $s has been initialized. Also handy
are transactional versions that work on success or failure of the block:
my $s will keep { destroy $s } = new CoolClass;
my $s will undo { destroy $s } = new CoolClass;
There is no requirement for timely destruction in Perl 6.
Larry