From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Neil Jerram Newsgroups: gmane.lisp.guile.devel Subject: Re: srfi-18 requirements Date: Tue, 04 Dec 2007 22:20:52 +0000 Message-ID: <873auiqeyj.fsf@ossau.uklinux.net> References: <2bc5f8210710101854m1254160ei451026182b87e767@mail.gmail.com> <87lka8pvv3.fsf@laas.fr> <2bc5f8210710120831q5c90dcfes930595fa3eb16a77@mail.gmail.com> <2bc5f8210710151526t6345200ao997988c1877e8cce@mail.gmail.com> <4713EB20.3080608@member.fsf.org> <2bc5f8210710151547l5e245ed1ucaf07e9006e95387@mail.gmail.com> <2bc5f8210710290737j32fe7b1s86aaa7e084bb69b6@mail.gmail.com> <87ve7mmdpl.fsf@chbouib.org> <2bc5f8210711302108g12542615j2371d307a873d810@mail.gmail.com> <87hcj2pvfc.fsf@chbouib.org> <2bc5f8210712011959j1df7a1d8t1ccec044baa7d369@mail.gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1196806906 10095 80.91.229.12 (4 Dec 2007 22:21:46 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 4 Dec 2007 22:21:46 +0000 (UTC) Cc: guile-devel@gnu.org, =?iso-8859-1?Q?Ludovic_Court=E8s?= To: "Julian Graham" Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Tue Dec 04 23:21:56 2007 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Izg9H-0001F8-MN for guile-devel@m.gmane.org; Tue, 04 Dec 2007 23:21:51 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Izg90-00043P-V4 for guile-devel@m.gmane.org; Tue, 04 Dec 2007 17:21:35 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Izg8P-0003Km-LJ for guile-devel@gnu.org; Tue, 04 Dec 2007 17:20:57 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Izg8O-0003JG-Lu for guile-devel@gnu.org; Tue, 04 Dec 2007 17:20:57 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Izg8O-0003Iw-Cz for guile-devel@gnu.org; Tue, 04 Dec 2007 17:20:56 -0500 Original-Received: from mail3.uklinux.net ([80.84.72.33]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Izg8N-0008Gu-Co for guile-devel@gnu.org; Tue, 04 Dec 2007 17:20:55 -0500 Original-Received: from arudy (host86-145-183-175.range86-145.btcentralplus.com [86.145.183.175]) by mail3.uklinux.net (Postfix) with ESMTP id 943D51F690A; Tue, 4 Dec 2007 22:20:53 +0000 (GMT) Original-Received: from laruns (unknown [192.168.0.10]) by arudy (Postfix) with ESMTP id 052553800A; Tue, 4 Dec 2007 22:20:52 +0000 (GMT) In-Reply-To: <2bc5f8210712011959j1df7a1d8t1ccec044baa7d369@mail.gmail.com> (Julian Graham's message of "Sat, 1 Dec 2007 22:59:17 -0500") User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux) X-detected-kernel: by monty-python.gnu.org: Linux 2.4-2.6 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:6912 Archived-At: "Julian Graham" writes: >> Yes, I'd prefer, if that's not too much work (but in this case you may >> want to really use SRFI-34 and SRFI-35 rather than hand-write things >> like "(throw 'srfi-34 ...)"). > > Right, that's actually what I was trying to do, except that I've > discovered that SRFI-34 implements 'with-exception-handler' using > 'lazy-catch', which rethrows caught exceptions after it calls the > handler. What's the rationale for this behavior (SRFI-34's or > lazy-catch's)? lazy-catch rethrows because otherwise we can't provide a guarantee of reasonable behaviour to someone who writes code that calls `error' or `throw' somewhere. In such situations, the coder should be able to assume that execution won't just continue normally past that call. If a lazy-catch handler returned normally, and libguile didn't do a rethrow itself (as it does now), that (execution continuing normally) is what would happen. This was hardly ever a problem in practice, because the usage pattern for lazy-catch was almost always that the lazy-catch handler would rethrow to a non-lazy catch just outside the lazy-catch. But we (Marius and I) thought it would make sense to enforce the non-returnability of the lazy-catch handler, by having libguile do the rethrow itself if the handler doesn't do a non-local exit. It also gave a minor bonus of meaning that lazy-catch handler code no longer has to do the rethrow itself. The thing that actually triggered all this was me working on SRFI-34, and then noticing an inconsistency in how lazy-catch works - i.e. that all the dynamic context apart from the stack (e.g. fluids) is unwound before the handler is called - and then adding `with-throw-handler', to provide a mechanism to allow the handler _really_ to be called in the full dynamic context of the error. I'm not sure now if the details of this strictly required libguile performing a rethrow, but it made good sense at the time. Moving on to SRFI 34, and how that relates to your question about rethrowing... The reference implementation calls `error' if a handler returns normally, which is like rethrowing in that it forces a non-local exit. Also note that in all the examples, the handler uses call/cc to do a jump, and so does not return normally. Well, I'm afraid that ended up being a bit rambly. Did it answer your question though? Neil _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://lists.gnu.org/mailman/listinfo/guile-devel