parent
f66fff1ca9
commit
f0c79b6b16
|
@ -63,11 +63,12 @@ The result of a @racket[parameterize] expression is the result of the
|
||||||
last @racket[body]. The @racket[parameter-expr]s determine the
|
last @racket[body]. The @racket[parameter-expr]s determine the
|
||||||
parameters to set, and the @racket[value-expr]s determine the
|
parameters to set, and the @racket[value-expr]s determine the
|
||||||
corresponding values to install while evaluating the
|
corresponding values to install while evaluating the
|
||||||
@racket[body-expr]s. All of the @racket[parameter-expr]s are evaluated
|
@racket[body-expr]s. The @racket[parameter-expr]s and
|
||||||
first (and checked with @racket[parameter?]), then all
|
@racket[value-expr]s are evaluated left-to-right (interleaved), and
|
||||||
@racket[value-expr]s are evaluated, and then the parameters are bound
|
then the parameters are bound in the continuation to preserved thread
|
||||||
in the continuation to preserved thread cells that contain the values
|
cells that contain the values of the @racket[value-expr]s; the result
|
||||||
of the @racket[value-expr]s. The last @racket[body-expr] is in tail
|
of each @racket[parameter-expr] is checked with @racket[parameter?]
|
||||||
|
just before it is bound. The last @racket[body-expr] is in tail
|
||||||
position with respect to the entire @racket[parameterize] form.
|
position with respect to the entire @racket[parameterize] form.
|
||||||
|
|
||||||
Outside the dynamic extent of a @racket[parameterize] expression,
|
Outside the dynamic extent of a @racket[parameterize] expression,
|
||||||
|
|
|
@ -1269,6 +1269,24 @@
|
||||||
(error-test #'(parameterize ([(lambda (a) 10) 10]) 8))
|
(error-test #'(parameterize ([(lambda (a) 10) 10]) 8))
|
||||||
(error-test #'(parameterize ([(lambda (a b) 10) 10]) 8))
|
(error-test #'(parameterize ([(lambda (a b) 10) 10]) 8))
|
||||||
|
|
||||||
|
;; Check documented order of evaluation
|
||||||
|
(let ([str (let ([o (open-output-string)])
|
||||||
|
(define p1 (make-parameter 1 (λ (x) (displayln "p1" o) x)))
|
||||||
|
(define p2 (make-parameter 2 (λ (x) (displayln "p2" o) x)))
|
||||||
|
(parameterize ([(begin (displayln "b1" o) p1) (begin (displayln "a1" o) 4)]
|
||||||
|
[(begin (displayln "b2" o) p2) (begin (displayln "a2" o) 5)])
|
||||||
|
3)
|
||||||
|
(get-output-string o))])
|
||||||
|
(test "b1\na1\nb2\na2\np1\np2\n" values str))
|
||||||
|
(let ([str (let ([o (open-output-string)])
|
||||||
|
(define p1 (make-parameter 1 (λ (x) (displayln "p1" o) x)))
|
||||||
|
(err/rt-test/once
|
||||||
|
(parameterize ([(begin (displayln "b1" o) p1) (begin (displayln "a1" o) 4)]
|
||||||
|
[(begin (displayln "b2" o) 'no) (begin (displayln "a2" o) 5)])
|
||||||
|
3))
|
||||||
|
(get-output-string o))])
|
||||||
|
(test "b1\na1\nb2\na2\np1\n" values str))
|
||||||
|
|
||||||
(test 1 'time (time 1))
|
(test 1 'time (time 1))
|
||||||
(test -1 'time (time (cons 1 2) -1))
|
(test -1 'time (time (cons 1 2) -1))
|
||||||
(test-values '(-1 1) (lambda () (time (values -1 1))))
|
(test-values '(-1 1) (lambda () (time (values -1 1))))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user