develooper Front page | perl.perl5.porters | Postings from May 2006

Re: [perl #3306] DESTROY doesn't get called.

Thread Previous | Thread Next
Yuval Kogman
May 1, 2006 10:22
Re: [perl #3306] DESTROY doesn't get called.
Message ID:
On Mon, May 01, 2006 at 19:01:05 +0100, Dave Mitchell wrote:

> $sub and $copy are two distinct RVs that point to the same CV:
> $ perl588 -we 'sub foo { sub { } } my $sub = foo(); my $copy = foo(); print "$sub $copy\n"'
> CODE(0x9696bdc) CODE(0x9696bdc)

That's the current behavior, i was unclear but I meant that
hypothetically, in the "fixed" case, they are different refaddrs

> > and don't they have 'bless' handled by simply copying the sub to a
> > "normal" copy?
> bless currently just updates the pointed-top CV.

Hence copy on right

> > traditionally the optimization is that if the copy count is 1 then
> > this allocation can be written in place - this is more like shared
> > constants.
> I don't understand what point you're trying to make.

That an additional level of indirection, that is every referrant of
an RV pointing to a subroutine, 

This is what i propose:

	compiling of a sub will create a sub prototype, with no exposed
	perl space value

	CVs become a small node, with typical SVish things, like a
	blessed class, ref count, etc, and for closures they can also
	refer to captured variables, I guess

  Yuval Kogman <>  0xEBD27418

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About