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

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

Thread Previous | Thread Next
Ben Morrow
June 25, 2008 12:18
Re: Why $@ makes me cry (was Re: Generic system() replacements)
Message ID:

Quoth (Abigail):
> On Tue, Jun 24, 2008 at 11:20:23AM -0500, David Nicol wrote:
> > On Tue, Jun 24, 2008 at 10:39 AM, Abigail <> 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.


               We do not stop playing because we grow old; 
                  we grow old because we stop playing.

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