Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parameterize doesn't rewind correctly #129

Closed
shirok opened this issue Dec 11, 2015 · 1 comment
Closed

Parameterize doesn't rewind correctly #129

shirok opened this issue Dec 11, 2015 · 1 comment

Comments

@shirok
Copy link
Owner

shirok commented Dec 11, 2015

When an error is thrown within guard procedure.

Reported by Joo ChurlSoo. Here's a sample session exhibiting the bug.

gosh> (use gauche.parameter)

gosh>
(define a (make-parameter 1 number->string))
(define b (make-parameter 2 number->string))
a
gosh> b
gosh> (list (a) (b))
("1" "2")
gosh> (parameterize ((a 10) (b 20) (a 30) (b 40)) (list (a) (b)))
("30" "40")
gosh> (list (a) (b))
("10" "20")
gosh> (a 1) (b 2)
"10"
gosh> "20"
gosh> (list (a) (b))
("1" "2")
gosh> (parameterize ((a 10) (b 20) (a 30) (b 'ab)) (list (a) (b)))
*** ERROR: number required: ab
Stack Trace:


0 (P L)
[unknown location]
1 (^ () (set! S (P L)) (set! S (P L)) (set! S (P L)) (set! S (P L)))
[unknown location]
2 (eval expr env)
At line 179 of "c:\tilde\gauche\share\gauche-0.9\0.9.4\lib/gauche/interactive.scm"
gosh> (list (a) (b))
("30" "20")
gosh> (let ((f (make-parameter 'a))
(path '())
(g (make-parameter 'g))
(c #f))
(let ((add (lambda () (set! path (cons (f) path)))))
(add)
(parameterize ((f 'b)
(g (call-with-current-continuation
(lambda (c0) (set! c c0) 'c))))
(add) (f (g)) (add))
(f 'd)
(add)
(if (< (length path) 5)
(c 'e)
(reverse path))))
(a b c d c e d) ;; cf. (a b c d b e d)

@shirok
Copy link
Owner Author

shirok commented Dec 12, 2015

Fix pushed. 45e7262

The fix isn't ideal; we may revise it later.

@shirok shirok closed this as completed Dec 12, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant