megane <megan...@gmail.com> writes: > Peter Bex <pe...@more-magic.net> writes: > > Regarding the capturing, the capture test is still there: > > >> (when (and value (not global)) >> (when (eq? '##core#variable (node-class value)) >> - (let* ((name (first (node-parameters value))) >> - (nrefs (db-get db name 'references)) ) >> + (let ((name (first (node-parameters value))) ) >> (when (and (not captured) > ^^^^^^^^^^^^^^ > Here. > I got the impression you wanted to remove this. >
Of course if this is dropped the other conditions must still meet. Here's your proposed condition: (and (not captured) (or (and (not (db-get db name 'unknown)) (db-get db name 'value)) (and (not assigned) (not (db-get db name 'assigned)) (or (not (variable-visible? name block-compilation)) (not (db-get db name 'global))) ) )) If the (not captured) part is just dropped then if the first branch of the or is taken, namely this: (and (not (db-get db name 'unknown)) (db-get db name 'value)) then it's not checked that the variable to be replaced is never assigned to! Here's a case that triggers the error: (define (foo x) (letrec ((pe* (lambda () (print x) (pe*)))) (pe*))) (foo '((foo1 e))) (foo 'foo2) The letrec expands to an assignment and to a (##core#undefined) that triggers the first branch of the or. Here's a correct way to drop the (not captured) check: (and (not assigned) (or (and (not (db-get db name 'unknown)) (db-get db name 'value)) (and (not (db-get db name 'assigned)) (or (not (variable-visible? name block-compilation)) (not (db-get db name 'global))) ) )) _______________________________________________ Chicken-hackers mailing list Chicken-hackers@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-hackers