develooper Front page | perl.perl5.porters | Postings from September 2013

[perl #6278] Explicit call of ->DESTROY method considered harmful

Thread Previous | Thread Next
From:
James E Keenan via RT
Date:
September 19, 2013 00:04
Subject:
[perl #6278] Explicit call of ->DESTROY method considered harmful
Message ID:
rt-3.6.HEAD-1873-1379549035-1144.6278-15-0@perl.org
On Sat May 05 05:40:11 2012, Hugmeir wrote:
> On Sun May 01 15:50:43 2011, sprout wrote:
> > On Fri Jul 18 12:44:06 2003, robert wrote:
> > > 
> > > ISO8--%%- [ON] Wanderlust: %p5p {T}(0/0/148)     
> > > (Summary)----L142--C0--Bot----
> > > From: Tony Bowden <tony@kasei.com> 
> > > To: perl5-porters@perl.org 
> > > Cc: mjd@plover.com 
> > > Subject: Bug #6278: Explict call to DESTROY considered harmful 
> > > Date: Fri, 18 Jul 2003 19:15:19 +0100 
> > >  
> > >  
> > > http://bugs6.perl.org/rt2/Ticket/Display.html?id=6278 
> > >  
> > > MJD considered changing perltoot to turn "Explicitly calling
DESTROY is 
> > > also possible, but is usually never needed." into something more
> strongly 
> > > warning against ever doing it. 
> > >  
> > > His original report never made it to p5p, but Damian's response did, 
> > > thus triggering a longish thread on what was wrong with perlbug. 
> > >  
> > > However this left the bug report itself hanging. 
> > >  
> > > As Damian pointed out, you may need to call DESTROY directly when 
> > > inheriting. 
> > >  
> > > This leaves 2 main options: 
> > >  
> > > 1) Leave everything as is, and close the bug. 
> > >  
> > > 2) Add something to the docs that changes the above line into
something 
> > > akin to: 
> > >  
> > > Explicitly calling DESTROY should be avoided, other than when calling 
> > > SUPER::DESTROY. 
> > >  
> > >  
> > > Thoughts/comments? 
> > 
> > Sometimes it’s necessary to call destructors pre-emptively in an END
> > block, if they rely on the presence of other objects. But in such cases,
> > one must ensure that the destructors are idempotent (e.g., return if
> > $self->{destroyed}++).
> 
> Well, perltoot doesn't exist anymore, and there's nothing about calling
> DESTROY directly in perlobj and perlootut anymore, so maybe this ticket
> can be marked as resolved. Though it would be nice if a executive
> summary of this thread made it into perlobj.


Hugmeir,

It appears to me that in pod/perlobj.pod, the section starting at
"=head2 Destructors" *does* talk about calling DESTROY directly.

Could you (or anyone review that section of perlobj.pod) and prepare a
patch if needed?

Otherwise, I recommend that this RT be closed in 30 days.

Thank you very much.
Jim Keenan

---
via perlbug:  queue: perl5 status: open
https://rt.perl.org:443/rt3/Ticket/Display.html?id=6278

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