From 62744c1a6a6d5fb3f2d6036ce82023beebbff2c1 Mon Sep 17 00:00:00 2001 From: Mark H Weaver Date: Tue, 13 Aug 2013 19:52:48 -0400 Subject: Manual: don't promise that 'append!' will modify the existing lists. * doc/ref/api-compound.texi (Append/Reverse): Say that 'append!' *may* modify the given lists, but don't promise that it will. --- doc/ref/api-compound.texi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/ref/api-compound.texi b/doc/ref/api-compound.texi index 699e7601c..37b0a8ca3 100644 --- a/doc/ref/api-compound.texi +++ b/doc/ref/api-compound.texi @@ -459,7 +459,7 @@ list results if the last argument is not a proper list. @end lisp @code{append} doesn't modify the given lists, but the return may share -structure with the final @var{obj}. @code{append!} modifies the +structure with the final @var{obj}. @code{append!} may modify the given lists to form its return. For @code{scm_append} and @code{scm_append_x}, @var{lstlst} is a list -- cgit v1.2.3 From b57162c3d21fdc9e48572d7a9d4009c37f2c647a Mon Sep 17 00:00:00 2001 From: Mark H Weaver Date: Tue, 13 Aug 2013 20:33:18 -0400 Subject: Manual: clarify that 'append!' and 'reverse!' might not mutate. * doc/ref/api-compound.texi (Append/Reverse): Clarify that 'append!' and 'reverse!' are not required to modify anything. --- doc/ref/api-compound.texi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/ref/api-compound.texi b/doc/ref/api-compound.texi index 37b0a8ca3..1990d777d 100644 --- a/doc/ref/api-compound.texi +++ b/doc/ref/api-compound.texi @@ -459,8 +459,8 @@ list results if the last argument is not a proper list. @end lisp @code{append} doesn't modify the given lists, but the return may share -structure with the final @var{obj}. @code{append!} may modify the -given lists to form its return. +structure with the final @var{obj}. @code{append!} is permitted, but +not required, to modify the given lists to form its return. For @code{scm_append} and @code{scm_append_x}, @var{lstlst} is a list of the list operands @var{lst} @dots{} @var{obj}. That @var{lstlst} @@ -474,8 +474,8 @@ itself is not modified or used in the return. @deffnx {C Function} scm_reverse_x (lst, newtail) Return a list comprising the elements of @var{lst}, in reverse order. -@code{reverse} constructs a new list, @code{reverse!} modifies -@var{lst} in constructing its return. +@code{reverse} constructs a new list. @code{reverse!} is permitted, but +not required, to modify @var{lst} in constructing its return. For @code{reverse!}, the optional @var{newtail} is appended to the result. @var{newtail} isn't reversed, it simply becomes the list -- cgit v1.2.3 From 8d5d0425ce10dcf035fbf717852938291261bd7e Mon Sep 17 00:00:00 2001 From: Mark H Weaver Date: Thu, 15 Aug 2013 03:59:15 -0400 Subject: Improve run-time error reporting in (ice-9 match). * module/Makefile.am: match.go depends on match.upstream.scm. * module/ice-9/match.scm (error): Accept any number of arguments. * module/ice-9/match.upstream.scm (match-next): Call 'error' in non-tail context, and include the value that failed to match in the call. --- module/Makefile.am | 1 + module/ice-9/match.scm | 4 ++-- module/ice-9/match.upstream.scm | 5 ++++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/module/Makefile.am b/module/Makefile.am index d43be04d6..e8dcd4a13 100644 --- a/module/Makefile.am +++ b/module/Makefile.am @@ -33,6 +33,7 @@ EXTRA_DIST += ice-9/eval.scm ETAGS_ARGS += ice-9/eval.scm ice-9/boot-9.go: ice-9/boot-9.scm ice-9/quasisyntax.scm ice-9/r6rs-libraries.scm +ice-9/match.go: ice-9/match.scm ice-9/match.upstream.scm # We can compile these in any order, but it's fastest if we compile # psyntax and boot-9 first, then the compiler itself, then the rest of diff --git a/module/ice-9/match.scm b/module/ice-9/match.scm index 7fd191a11..099afb53a 100644 --- a/module/ice-9/match.scm +++ b/module/ice-9/match.scm @@ -24,9 +24,9 @@ match-let* match-letrec)) -(define (error _ msg) +(define (error _ . args) ;; Error procedure for run-time "no matching pattern" errors. - (throw 'match-error "match" msg)) + (apply throw 'match-error "match" args)) ;; Support for record matching. diff --git a/module/ice-9/match.upstream.scm b/module/ice-9/match.upstream.scm index 29f9dbe2e..4609883d2 100644 --- a/module/ice-9/match.upstream.scm +++ b/module/ice-9/match.upstream.scm @@ -284,7 +284,10 @@ (syntax-rules (=>) ;; no more clauses, the match failed ((match-next v g+s) - (error 'match "no matching pattern")) + ;; Here we wrap error within a double set of parentheses, so that + ;; the call to 'error' won't be in tail position. This allows the + ;; backtrace to show the source location of the failing match form. + ((error 'match "no matching pattern" v))) ;; named failure continuation ((match-next v g+s (pat (=> failure) . body) . rest) (let ((failure (lambda () (match-next v g+s . rest)))) -- cgit v1.2.3