develooper Front page | perl.perl6.internals | Postings from April 2005

Re: parrot and refcounting semantics

Thread Previous | Thread Next
From:
Leopold Toetsch
Date:
April 29, 2005 06:28
Subject:
Re: parrot and refcounting semantics
Message ID:
200504291305.j3TD5Ei12199@thu8.leo.home
Gerald Butler <gerald.butler@jewels.com> 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

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About