On Thu, 28 Apr 2005, Luke Palmer wrote: > Or, with the "block hooks" that I keep claiming makes timely destruction > almost never needed, it is: > > { > my $s = new CoolClass; > # ... do stuff that may throw ... > LEAVE { destroy $s } > } > > This destroys properly and even propagates the exception.
That's good ... but can we have a shorthand; stealing an old C keyword, I'd suggest: { auto $a = new CoolClass; # ... do stuff that my throw ... }