Heath Putnam
2012-12-23 13:07:21 UTC
There's a bug in ps-compiler/prescheme/flatten.scm
If you try compiling this code, the prescheme compiler loops forever
in FLATTEN-DEFINITIONS:
(define-structure foo
(export a b)
(open prescheme)
(begin
(define (a)
(set! b (lambda () 100)))
(define b (lambda () -2))
))
The code to do the looping doesn't cdr down the list of definitions.
None of the code in the s48 distribution features global variables of
type closure that get assigned (or this bug would have already turned
up).
Also, for reasons I don't understand, if you change
FLATTEN-DEFINITIONS so that the check (and (variable-set!? var)
(closure? value)) always fails, which ensures ensures termination, the
compiler nevertheless seems to put B into a variable and everything
works anyway. That makes me think my test program could be better.
If anyone can recommend a better test program, I'd appreciate it.
Heath
If you try compiling this code, the prescheme compiler loops forever
in FLATTEN-DEFINITIONS:
(define-structure foo
(export a b)
(open prescheme)
(begin
(define (a)
(set! b (lambda () 100)))
(define b (lambda () -2))
))
The code to do the looping doesn't cdr down the list of definitions.
None of the code in the s48 distribution features global variables of
type closure that get assigned (or this bug would have already turned
up).
Also, for reasons I don't understand, if you change
FLATTEN-DEFINITIONS so that the check (and (variable-set!? var)
(closure? value)) always fails, which ensures ensures termination, the
compiler nevertheless seems to put B into a variable and everything
works anyway. That makes me think my test program could be better.
If anyone can recommend a better test program, I'd appreciate it.
Heath