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

Re: [perl #124387] AUTOLOAD is not called when DESTROY is missing in5.20.1 - but this is not documented

Thread Previous
From:
Ricardo Signes
Date:
May 26, 2015 12:01
Subject:
Re: [perl #124387] AUTOLOAD is not called when DESTROY is missing in5.20.1 - but this is not documented
Message ID:
20150526120126.GB15129@cancer.codesimply.com
* Dave Mitchell <davem@iabyn.com> [2015-04-25T06:25:34]
> On Fri, Apr 24, 2015 at 11:16:23PM -0700, Gabor Szabo wrote:
> > In earlier versions of perl if AUTOLOAD is defined in a module but DESTROY
> > is not defined, the AUTOLOAD would be executed when the object goes out of
> > scope and one would have had to add an empty DESTROY to eliminate the
> > problem caused by this.
> > [...]
> The change bisects to this, which leads to the suspicion that it was
> unintended.
> 
> commit 8c34e50dccefe2a0539ba2339a2889bb841986c2

That does look unintended.  I don't see discussion of the change on p5p or
changes to tests, either.

I know I've added special casing to AUTOLOADs to skip DESTROY, which makes me
feel certain that people have used AUTOLOAD to handle DESTROY.  Sure, it's been
broken for three years now, but unless there is a compelling reason against it,
I think we should restore this behavior and add a regression test.

The downside is breaking code only ever written or tested on 5.18.0, or later.
In other words, we'd be fixing a regression introduced before the earliest
supported version of perl.  Still, I think it should be fixed.

-- 
rjbs

Thread Previous


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