From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Andy Wingo Newsgroups: gmane.lisp.guile.devel Subject: Re: [PATCH 1/2] srfi-34: Replace the 'raise' core binding. Date: Tue, 26 Nov 2019 11:09:25 +0100 Message-ID: <877e3nt0dm.fsf@igalia.com> References: <20191125164555.15124-1-ludo@gnu.org> <20191125164555.15124-2-ludo@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="79184"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) Cc: guile-devel@gnu.org To: Ludovic =?utf-8?Q?Court=C3=A8s?= Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Tue Nov 26 11:24:34 2019 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iZY1K-000KVL-0z for guile-devel@m.gmane.org; Tue, 26 Nov 2019 11:24:34 +0100 Original-Received: from localhost ([::1]:52290 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iZY1I-0000da-G9 for guile-devel@m.gmane.org; Tue, 26 Nov 2019 05:24:32 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57349) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iZXsJ-0005R4-3M for guile-devel@gnu.org; Tue, 26 Nov 2019 05:15:16 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iZXmq-0003PN-B3 for guile-devel@gnu.org; Tue, 26 Nov 2019 05:09:37 -0500 Original-Received: from fanzine.igalia.com ([178.60.130.6]:55439) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iZXmq-0003P0-2v; Tue, 26 Nov 2019 05:09:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:References:Subject:Cc:To:From; bh=ZqRQLPdiwjU0o2YALFICdgIDdlY7KRS3DidrMt9/Mro=; b=iCDLiBX7w3rA86iuZJheW9KkKmsw1VMMjZQu8lW/m9sHSiA4WR3cL/+eg0nqBHFwPTzJaiwPUx++zeuQnGUcOG+H0qMOGvHeEFuBf/Sv+eWTbTwHtiv+8NDHaObBJu9qv1IGjHb1GDcBu5u2SZBty4GiJXK1b66md7RhRci0sPq8qCEHUP/pps3xf9svZxWvVcAT3PgQWeC/Rnlwn0TnUHitCFp8EqVtI6tQTvW8657ssQUYi36RCa9w/dsETw81tJ+FWBDAmQyO5I/fjb3nQNM+iLNWVwSzL1HJInFZS9+CQqzh2err4dwd1SLbD+TfRPmmTDoKjaWp4SYK2iqOHA==; Original-Received: from lfbn-ann-1-376-195.w86-200.abo.wanadoo.fr ([86.200.91.195] helo=milano) by fanzine.igalia.com with esmtpsa (Cipher TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim) id 1iZXmo-0005yM-Ti; Tue, 26 Nov 2019 11:09:35 +0100 In-Reply-To: <20191125164555.15124-2-ludo@gnu.org> ("Ludovic \=\?utf-8\?Q\?Cou\?\= \=\?utf-8\?Q\?rt\=C3\=A8s\=22's\?\= message of "Mon, 25 Nov 2019 17:45:54 +0100") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] [fuzzy] X-Received-From: 178.60.130.6 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: "guile-devel" Xref: news.gmane.org gmane.lisp.guile.devel:20170 Archived-At: On Mon 25 Nov 2019 17:45, Ludovic Court=C3=A8s writes: > In Guile 2.x, (srfi srfi-34) would already replace 'raise'. Replacing > avoids a run-time warning about the core binding being overridden. > > * module/srfi/srfi-34.scm (raise): New variable. > Mark it as #:replace instead of #:re-export. > --- > module/srfi/srfi-34.scm | 10 +++++++--- > 1 file changed, 7 insertions(+), 3 deletions(-) > > diff --git a/module/srfi/srfi-34.scm b/module/srfi/srfi-34.scm > index 0e7ad995d..255bfecb9 100644 > --- a/module/srfi/srfi-34.scm > +++ b/module/srfi/srfi-34.scm > @@ -1,6 +1,6 @@ > ;;; srfi-34.scm --- Exception handling for programs >=20=20 > -;; Copyright (C) 2003, 2006, 2008, 2010 Free Software Foundation, Inc. > +;; Copyright (C) 2003, 2006, 2008, 2010, 2019 Free Software Foundation, = Inc. > ;; > ;; This library is free software; you can redistribute it and/or > ;; modify it under the terms of the GNU Lesser General Public > @@ -27,12 +27,16 @@ > ;;; Code: >=20=20 > (define-module (srfi srfi-34) > - #:re-export (with-exception-handler > - (raise-exception . raise)) > + #:re-export (with-exception-handler) > + #:replace (raise) > #:export-syntax (guard)) >=20=20 > (cond-expand-provide (current-module) '(srfi-34)) >=20=20 > +(define (raise exn) > + "Raise the given exception, invoking the current exception handler on = EXN." > + (raise-exception exn)) LGTM but it is better to re-export if possible. The reason is that right now the compiler recognizes "throw" and "error" as not falling through, and this is good for a number of reasons; it would be nice to extend this to raise-exception. We should make it possible to re-export and replace at the same time, IMO. Andy