On Tue, Feb 13, 2001 at 10:32:26AM -0800, Peter Scott wrote:
> At 01:16 PM 2/13/01 -0500, James Mastros wrote:
> >On Tue, Feb 13, 2001 at 01:09:11PM -0500, John Porter wrote:
> >Certainly AUTOLOAD gets
> > > called if DESTROY is called but not defined ... just
> > > like any other method.
> >The idea is [for Larry] to declare "no, it isn't". Otherwise, you have to
> >do refcounting (or somthing like it) for DESTROY to get called at the right
> >time if the class (or any superclass) has an AUTOLOAD, which is expensive.
> >
> >Perhaps you could declare, but not define, DESTROY to have AUTOLOAD called
> >for DESTROY, and have DESTROY called as soon as the last ref goes out of
> >scope. (IE have a sub DESTROY; line.)
I like this idea, and would have suggested it except that James Mastros got
there first. It is a special case "no AUTOLOAD of DESTROY by default"
but it might be quite a win.
> This may be a naive question, but what is the benefit - aside from
> consistency, and we don't need to rehash the litany on that - to AUTOLOAD
> getting called for DESTROY? I've never actually seen any code that makes
> use of it. I have grown somewhat tired of writing, and teaching, "return
> if $AUTOLOAD =~ /:DESTROY$/", however.
Doesn't
sub DESTROY {}
have the same effect but with less typing?
Nicholas Clark