From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12148 invoked from network); 2 Oct 2005 08:06:42 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 2 Oct 2005 08:06:42 -0000 Received: (qmail 69990 invoked from network); 2 Oct 2005 08:06:36 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 2 Oct 2005 08:06:36 -0000 Received: (qmail 1809 invoked by alias); 2 Oct 2005 08:06:33 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 21800 Received: (qmail 1799 invoked from network); 2 Oct 2005 08:06:33 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 2 Oct 2005 08:06:33 -0000 Received: (qmail 69774 invoked from network); 2 Oct 2005 08:06:32 -0000 Received: from ns9.hostinglmi.net (213.194.149.146) by a.mx.sunsite.dk with SMTP; 2 Oct 2005 08:06:31 -0000 Received: from 212.red-80-35-44.staticip.rima-tde.net ([80.35.44.212] helo=localhost) by ns9.hostinglmi.net with esmtpa (Exim 4.52) id 1ELyrf-0002n7-97; Sun, 02 Oct 2005 10:06:31 +0200 Date: Sun, 2 Oct 2005 10:06:56 +0200 From: DervishD To: Bart Schaefer Cc: Peter Stephenson , zsh-workers@sunsite.dk Subject: Re: Exception handling and "trap" vs. TRAPNAL() Message-ID: <20051002080656.GA67@DervishD> Mail-Followup-To: Bart Schaefer , Peter Stephenson , zsh-workers@sunsite.dk References: <20050929200741.GA1156@DervishD> <20050930124130.45eb0463.pws@csr.com> <20051001153756.GA12183@DervishD> <1051001183818.ZM27904@candle.brasslantern.com> <20051001191035.2A4F48673@pwstephenson.fsnet.co.uk> <1051001224406.ZM28125@candle.brasslantern.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1051001224406.ZM28125@candle.brasslantern.com> User-Agent: Mutt/1.4.2.1i Organization: DervishD X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - ns9.hostinglmi.net X-AntiAbuse: Original Domain - sunsite.dk X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - dervishd.net X-Source: X-Source-Args: X-Source-Dir: X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.0.4 Hi Bart :) * Bart Schaefer 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...