Zsh Mailing List Archive
Messages sorted by:
Re: Exception handling and "trap" vs. TRAPNAL()
- X-seq: zsh-workers 21800
- From: DervishD <zsh@xxxxxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Subject: Re: Exception handling and "trap" vs. TRAPNAL()
- Date: Sun, 2 Oct 2005 10:06:56 +0200
- Cc: Peter Stephenson <pws@xxxxxxxxxxxxxxxxxxxxxxxx>, zsh-workers@xxxxxxxxxx
- In-reply-to: <1051001224406.ZM28125@xxxxxxxxxxxxxxxxxxxxxxx>
- Mail-followup-to: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>, Peter Stephenson <pws@xxxxxxxxxxxxxxxxxxxxxxxx>, zsh-workers@xxxxxxxxxx
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- Organization: DervishD
- References: <20050929200741.GA1156@DervishD> <20050930124130.45eb0463.pws@xxxxxxx> <20051001153756.GA12183@DervishD> <1051001183818.ZM27904@xxxxxxxxxxxxxxxxxxxxxxx> <20051001191035.2A4F48673@xxxxxxxxxxxxxxxxxxxxxxxx> <1051001224406.ZM28125@xxxxxxxxxxxxxxxxxxxxxxx>
Hi Bart :)
* Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> dixit:
> } You can certainly argue that the "normal effect" of a ZERR trap is not
> } to cause an error, and it's certainly possible to argue that yet more
> } hacked-up special cases and additional bug-prone complexity in the trap
> } code are warranted.
> Well, that's just it. An even stronger argument than the no-man's
> land proposition, is that errflag should *not* be propagated out of
> a ZERR trap. This would not accomplish what Raúl wants, because it
> would mean that *neither* TRAPZERR nor "trap ... ZERR" would be
> capable of "raising an exception" -- in effect we'd be removing a
> special-case, not adding one.
But as I told in one of my last messages, that's ok too. My
problem is not really about not being able to throw an exception from
a trap, but having one kind of trap that works and another that
doesn't with no special reason. I will be equally happy if this is
shown in the documentation or the special-case removed.
This said, being able to throw an exception from a trap is IMHO
desirable. In the end, both traps and exceptions are tools for doing
cleanup or recovering from errors, so common usage is not a bad idea.
Of course, even in the case of not being able to throw exceptions
from traps, is more or less easy (assuming that shell scripts are
short snippets of code in the common case) to implement a way of
throwing exceptions if some trap is invoked, by setting a variable
and doing a busy loop or something like that, so... Not the best
solution but it's a suitable one.
Raúl Núñez de Arenas Coronado
Linux Registered User 88736 | http://www.dervishd.net
http://www.pleyades.net & http://www.gotesdelluna.net
It's my PC and I'll cry if I want to...
Messages sorted by: