Gerald Butler <[EMAIL PROTECTED]> wrote:
> Isn't there something like:
> {
> my $s does LEAVE { destroy $s } = new CoolClass;
> # ... do stuff that may throw ...
> }
> Or something like that?
Not currently. There used to be a C<destroy> opcode, but I've deleted
it, because I thought it's too dangerous. But it could be useful *if*
the compiler or parrot hacker really knows that there is not any
reference to that object around.
Above would roughly translate to
leave = newsub .Closure, _LEAVE
pushaction leave
...
s = newclass "CoolClass"
...
.end
.sub _LEAVE
s = find_lex "$s"
destroy s
.end
(variable declarations omitted)
leo