1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-02 04:40:29 +02:00

common slot accessors are procedures-with-setters

* module/system/base/syntax.scm (define-type): Common slot accessors are
  also procedures-with-setters.
This commit is contained in:
Andy Wingo 2009-02-27 10:56:15 +01:00
parent 2c65f2d5a7
commit 246be37e48

View file

@ -47,10 +47,11 @@
,@(cdr def))) ,@(cdr def)))
rest) rest)
,@(map (lambda (common-slot i) ,@(map (lambda (common-slot i)
`(define (,(symbol-append (trim-brackets name) `(define ,(symbol-append (trim-brackets name)
'- common-slot) '- common-slot)
x) (make-procedure-with-setter
(struct-ref x ,i))) (lambda (x) (struct-ref x ,i))
(lambda (x v) (struct-set! x ,i v)))))
common-slots (iota (length common-slots))))))) common-slots (iota (length common-slots)))))))