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:
parent
2c65f2d5a7
commit
246be37e48
1 changed files with 5 additions and 4 deletions
|
@ -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)))))))
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue