develooper Front page | perl.perl5.porters | Postings from June 2008

Re: Why $@ makes me cry (was Re: Generic system() replacements)

Thread Previous | Thread Next
From:
Ben Morrow
Date:
June 25, 2008 12:18
Subject:
Re: Why $@ makes me cry (was Re: Generic system() replacements)
Message ID:
bkhaj5-jm4.ln1@osiris.mauzo.dyndns.org

Quoth abigail@abigail.be (Abigail):
> On Tue, Jun 24, 2008 at 11:20:23AM -0500, David Nicol wrote:
> > On Tue, Jun 24, 2008 at 10:39 AM, Abigail <abigail@abigail.be> wrote:
> > > in general
> > > we do care about backwards compat issues.
> > 
> > Does pushing all exceptions to @@ whenever $@ gets assigned to break
> > anything?
> 
> In theory, it could, as @@ is a "normal" array that can be used as such.
> But I doubt anything serious will break.

Quite apart from that, exception objects will no longer be destroyed at
the usual time (when the next exception is thrown). Indeed, unless user
code takes the trouble to explicitly clear @@ (which no code written to
date will, obviously), all exception objects will last forever. This
seems like a bad idea...

One approach that might work is to push $@ onto @@ iff @@ has been
localised: that way, only code that explicitly asks for this behaviour
gets it, and the (dynamic) scope of the saved exceptions is necessarily
limited. This would be rather odd behaviour, though, so it would need
careful documentation.

> I'd say anyone that uses a punctuation variable that currently has no 
> special meaning does so at his/her own risk, and doesn't have the right
> to complain if it does get special meaning.

Yes. All punctuation variables are documented as being reserved to perl,
even the ones not currently used.

Ben

-- 
               We do not stop playing because we grow old; 
                  we grow old because we stop playing.
                            ben@morrow.me.uk

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