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 09:33
Re: [perl #3306] DESTROY doesn't get called.
Message ID:
On Mon, May 01, 2006 at 17:38:13 +0100, Dave Mitchell wrote:

> One possible fix would be a COW scheme: when bless tries to bless a code
> ref that happens to be an anon sub prototype, a new prototype is made and
> stuck in the pad for future use. But that doesn't completely solve the
> problem: any existing refs to the shared protoype will get to see the
> blessed version of the sub.

Why is there a distinction between prototype and non prototype?

sub foo { sub { } };
my $sub = foo();
my $copy = foo();

aren't $sub and $copy different ref addrs? and don't they have
'bless' handled by simply copying the sub to a "normal" copy?

traditionally the optimization is that if the copy count is 1 then
this allocation can be written in place - this is more like shared

  Yuval Kogman <>  0xEBD27418

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