[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] branch master updated: Update match's no-matching-patter
From: |
Andy Wingo |
Subject: |
[Guile-commits] branch master updated: Update match's no-matching-pattern code to use "throw" |
Date: |
Sun, 17 May 2020 16:28:45 -0400 |
This is an automated email from the git hooks/post-receive script.
wingo pushed a commit to branch master
in repository guile.
The following commit(s) were added to refs/heads/master by this push:
new 087bb68 Update match's no-matching-pattern code to use "throw"
087bb68 is described below
commit 087bb683c8434643acfd210cf1ba436143918729
Author: Andy Wingo <address@hidden>
AuthorDate: Sun May 17 22:12:52 2020 +0200
Update match's no-matching-pattern code to use "throw"
* module/ice-9/match.upstream.scm (match-next): Use throw, so that CPS
can see that there's no fallthrough.
* module/ice-9/match.scm: Add a note about what to do in 3.1 to remove
the old "error" definition.
---
module/ice-9/match.scm | 12 ++++++++----
module/ice-9/match.upstream.scm | 2 +-
2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/module/ice-9/match.scm b/module/ice-9/match.scm
index 099afb5..b9c2149 100644
--- a/module/ice-9/match.scm
+++ b/module/ice-9/match.scm
@@ -1,6 +1,6 @@
;;; -*- mode: scheme; coding: utf-8; -*-
;;;
-;;; Copyright (C) 2010, 2011, 2012 Free Software Foundation, Inc.
+;;; Copyright (C) 2010, 2011, 2012, 2020 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
@@ -24,11 +24,15 @@
match-let*
match-letrec))
+;; Support for record matching.
+
+;; For backwards compatibility with previously-compiled files, keep the
+;; old definition of "error" around.
(define (error _ . args)
- ;; Error procedure for run-time "no matching pattern" errors.
(apply throw 'match-error "match" args))
-
-;; Support for record matching.
+;; FIXME: In 3.1.x, use this new definition:
+;; (define-syntax-rule (error where msg datum)
+;; (throw 'match-error "match" msg datum))
(define-syntax slot-ref
(syntax-rules ()
diff --git a/module/ice-9/match.upstream.scm b/module/ice-9/match.upstream.scm
index 1983c1e..b1fc371 100644
--- a/module/ice-9/match.upstream.scm
+++ b/module/ice-9/match.upstream.scm
@@ -292,7 +292,7 @@
;; Here we call error in non-tail context, so that the backtrace
;; can show the source location of the failing match form.
(begin
- (error 'match "no matching pattern" v)
+ (throw 'match-error "match" "no matching pattern" v)
#f))
;; named failure continuation
((match-next v g+s (pat (=> failure) . body) . rest)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Guile-commits] branch master updated: Update match's no-matching-pattern code to use "throw",
Andy Wingo <=