From: Chris Hanson Date: Tue, 1 Mar 2016 21:34:06 +0000 (-0800) Subject: Fix a test problem caused by make-parameter changing to unsettable. X-Git-Tag: mit-scheme-pucked-9.2.12~261^2~80 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=ebb5c798b16065afe4e1baf76be1aaf8f2e0f31e;p=mit-scheme.git Fix a test problem caused by make-parameter changing to unsettable. Thanks to craven@gmx.net for finding this. --- diff --git a/doc/ref-manual/misc-datatypes.texi b/doc/ref-manual/misc-datatypes.texi index 61e6212be..2b0e48551 100644 --- a/doc/ref-manual/misc-datatypes.texi +++ b/doc/ref-manual/misc-datatypes.texi @@ -432,6 +432,8 @@ This procedure is like @code{make-parameter}, except that the returned parameter object may also be assigned by passing it an argument. Note that an assignment to a settable parameter affects only the extent of its current binding. + +@code{make-settable-parameter} is an MIT/GNU Scheme extension. @end deffn @deffn procedure parameterize* bindings thunk @@ -440,7 +442,7 @@ new values. Returns the value of @var{thunk} while the parameters are dynamically bound to the values. Note that the @code{parameterize} special form expands into a call to -this procedure. +this procedure. @code{parameterize*} is an MIT/GNU Scheme extension. @end deffn @anchor{Cells} diff --git a/doc/ref-manual/special-forms.texi b/doc/ref-manual/special-forms.texi index 385c43f4f..fc5ec5731 100644 --- a/doc/ref-manual/special-forms.texi +++ b/doc/ref-manual/special-forms.texi @@ -419,7 +419,7 @@ to jump in and out of the body repeatedly. @example @group (define (complicated-dynamic-parameter) - (let ((variable (make-parameter 1)) + (let ((variable (make-settable-parameter 1)) (inside-continuation)) (write-line (variable)) (call-with-current-continuation diff --git a/tests/runtime/test-dynamic-env.scm b/tests/runtime/test-dynamic-env.scm index 581231b50..75190168c 100644 --- a/tests/runtime/test-dynamic-env.scm +++ b/tests/runtime/test-dynamic-env.scm @@ -30,23 +30,26 @@ USA. (define-test 'PARAMETERS (lambda () + (assert-eqv make-unsettable-parameter make-parameter) (let ((p (make-parameter 1)) - (q (make-parameter 2 (lambda (v) - (if (not (integer? v)) - (error:wrong-type-argument v "an integer" - 'PARAMETER-Q) - v))))) + (q (make-parameter 2 + (lambda (v) + (guarantee-exact-nonnegative-integer v) + v)))) (assert-eqv (p) 1) - (assert-equal (parameterize ((p "7") (q 9)) (cons (p) (q))) + (assert-equal (parameterize ((p "7") (q 9)) + (cons (p) (q))) '("7" . 9)) (assert-equal (cons (p) (q)) '(1 . 2)) - (assert-error (lambda () (parameterize ((q "7")) (q))) + (assert-error (lambda () + (parameterize ((q "7")) + (q))) (list condition-type:wrong-type-argument))))) ;; From node "Dynamic Binding" in doc/ref-manual/special-forms.texi: (define (complicated-dynamic-parameter) - (let ((variable (make-parameter 1)) + (let ((variable (make-settable-parameter 1)) (inside-continuation)) (write-line (variable)) (call-with-current-continuation