1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 20:00:19 +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)))
rest)
,@(map (lambda (common-slot i)
`(define (,(symbol-append (trim-brackets name)
'- common-slot)
x)
(struct-ref x ,i)))
`(define ,(symbol-append (trim-brackets name)
'- common-slot)
(make-procedure-with-setter
(lambda (x) (struct-ref x ,i))
(lambda (x v) (struct-set! x ,i v)))))
common-slots (iota (length common-slots)))))))