make-procedure-with-setter inherits name from getter

* libguile/procs.c (scm_make_procedure_with_setter): Patch through the
  getter's procedure name to the procedure-with-setter. Fixes part of the
  srfi-17 test, as the VM doesn't set procedure-name on define -- but
  perhaps that is the bug that should be fixed. In any case this patching
  is cheap.

* test-suite/tests/eval.test: Change so that (define name pws) is
  initially passed an anonymous procedure-with-setter, as was the case
  before the procs.c change.
This commit is contained in:
Andy Wingo 2008-11-01 17:12:23 +01:00
commit 3fd8807eab
2 changed files with 24 additions and 5 deletions

View file

@ -213,7 +213,11 @@
;;
(define foo-closure (lambda () "hello"))
(define bar-closure foo-closure)
(define foo-pws (make-procedure-with-setter car set-car!))
;; make sure that make-procedure-with-setter returns an anonymous
;; procedure-with-setter by passing it an anonymous getter.
(define foo-pws (make-procedure-with-setter
(lambda (x) (car x))
(lambda (x y) (set-car! x y))))
(define bar-pws foo-pws)
(with-test-prefix "define set procedure-name"
@ -222,7 +226,7 @@
(eq? 'foo-closure (procedure-name bar-closure)))
(pass-if "procedure-with-setter"
(eq? 'foo-pws (pk (procedure-name bar-pws)))))
(eq? 'foo-pws (procedure-name bar-pws))))
(if old-procnames-flag
(debug-enable 'procnames)