zsh-workers
 help / color / mirror / code / Atom feed
From: DervishD <zsh@dervishd.net>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: Peter Stephenson <pws@pwstephenson.fsnet.co.uk>, zsh-workers@sunsite.dk
Subject: Re: Exception handling and "trap" vs. TRAPNAL()
Date: Sun, 2 Oct 2005 10:06:56 +0200	[thread overview]
Message-ID: <20051002080656.GA67@DervishD> (raw)
In-Reply-To: <1051001224406.ZM28125@candle.brasslantern.com>

    Hi Bart :)

 * Bart Schaefer <schaefer@brasslantern.com> 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...


  reply	other threads:[~2005-10-02  8:06 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20050929200741.GA1156@DervishD>
     [not found] ` <20050930124130.45eb0463.pws@csr.com>
     [not found]   ` <20051001153756.GA12183@DervishD>
2005-10-01 18:38     ` Bart Schaefer
2005-10-01 19:10       ` Peter Stephenson
2005-10-01 20:41         ` DervishD
2005-10-01 22:44         ` Bart Schaefer
2005-10-02  8:06           ` DervishD [this message]
2005-10-01 20:28       ` DervishD
2005-10-02  4:40         ` Bart Schaefer
2005-10-02  8:13           ` DervishD
2005-10-02 19:09           ` Peter Stephenson
2005-10-02 19:55             ` Bart Schaefer
2005-10-02 23:00               ` DervishD
2005-10-03  1:37                 ` Bart Schaefer
2005-10-03  8:57                   ` Peter Stephenson
2005-10-03 14:51                     ` Bart Schaefer
2005-10-03 15:10                       ` Peter Stephenson
2005-10-03 16:50                         ` Bart Schaefer
2005-10-03  9:01                   ` DervishD
2005-10-03 16:21                     ` Bart Schaefer
2005-10-03 17:59                       ` DervishD
2005-10-04 16:31                         ` Bart Schaefer
2005-10-04 17:29                           ` DervishD
2005-10-04 17:34                             ` Peter Stephenson
2005-10-04 17:46                               ` DervishD
2005-10-01  8:01 DervishD
  -- strict thread matches above, loose matches on Subject: below --
2005-10-01  7:45 DervishD

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20051002080656.GA67@DervishD \
    --to=zsh@dervishd.net \
    --cc=pws@pwstephenson.fsnet.co.uk \
    --cc=schaefer@brasslantern.com \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).