From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22190 invoked from network); 6 Aug 2008 19:49:47 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) 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.2.5 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 6 Aug 2008 19:49:47 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 44013 invoked from network); 6 Aug 2008 19:49:30 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 6 Aug 2008 19:49:30 -0000 Received: (qmail 8088 invoked by alias); 6 Aug 2008 19:49:12 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 25410 Received: (qmail 8063 invoked from network); 6 Aug 2008 19:49:09 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 6 Aug 2008 19:49:09 -0000 Received: from mtaout02-winn.ispmail.ntl.com (mtaout02-winn.ispmail.ntl.com [81.103.221.48]) by bifrost.dotsrc.org (Postfix) with ESMTP id 517E2805A433 for ; Wed, 6 Aug 2008 21:49:06 +0200 (CEST) Received: from aamtaout01-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout02-winn.ispmail.ntl.com with ESMTP id <20080806194905.PWSJ21103.mtaout02-winn.ispmail.ntl.com@aamtaout01-winn.ispmail.ntl.com> for ; Wed, 6 Aug 2008 20:49:05 +0100 Received: from pws-pc.ntlworld.com ([81.107.40.67]) by aamtaout01-winn.ispmail.ntl.com with ESMTP id <20080806194905.TWAP5827.aamtaout01-winn.ispmail.ntl.com@pws-pc.ntlworld.com> for ; Wed, 6 Aug 2008 20:49:05 +0100 Received: from pws-pc (pws-pc [127.0.0.1]) by pws-pc.ntlworld.com (8.14.2/8.14.2) with ESMTP id m76Jn10k020995 for ; Wed, 6 Aug 2008 20:49:01 +0100 Message-Id: <200808061949.m76Jn10k020995@pws-pc.ntlworld.com> From: Peter Stephenson To: "Zsh hackers list" Subject: Re: PATCH: skip command from debug trap In-Reply-To: Message from "Rocky Bernstein" of "Wed, 06 Aug 2008 15:09:04 EDT." <6cd6de210808061209g30b82612r148e576dbe1941bd@mail.gmail.com> Date: Wed, 06 Aug 2008 20:49:01 +0100 X-Virus-Scanned: ClamAV 0.92.1/7960/Wed Aug 6 21:11:25 2008 on bifrost X-Virus-Status: Clean "Rocky Bernstein" wrote: > But given the choice of adding > 1) an option in the return statement everywhere that is specific to > just "trap DEBUG" or > 2) specifying what specific numbers do when on a return from "trap DEBUG", > > isn't 2) simpler and more consistent with programming in shell > languages work? I take it as a given that every function or command is > going to have error codes that are somewhat arbitrary and that I'm not > going to intuit. I'm in two minds about this. If we didn't have the existing rule that any non-zero return status from TRAPDEBUG, or any explicit return from within an inline trap, forced an immediate return, then I'd agree simply adding to the set of useful statuses was cleaner and more natural. As it is, we're now forced to pick some numeric value the user wouldn't naturally want to return from am enclosing context (since the return value is propagated). The option to return seems to me natural enough, because as "return" means "just return", so "return with an option" means "return but with slightly different semantics". Having a different return status meaning to execute different code (rather than simply provide a different test for the caller, as normal) is an unusual enough effect that it doesn't strike me as the unequivocal answer. But, whatever. If there's a number we all really like to mean "skip", we can go with that. It's already working, is easy to document, and doesn't need any changes to parsing. (By the way, it wouldn't be too hard, if not completely trivial, to pass down the code about to be executed in a variable, say DEBUG_CMD_LINE, as reconstructed text, i.e. the same sort of format as what you get if you get the shell to output a shell function that's already loaded. But it's messy enough that I won't unless it's definitely useful.) -- Peter Stephenson Web page now at http://homepage.ntlworld.com/p.w.stephenson/