mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-09 21:40:33 +02:00
Deprecate two-arg `record-constructor'
* module/ice-9/boot-9.scm (record-constructor): Deprecate the two-arg form.
This commit is contained in:
parent
0c8d20d2d0
commit
f7b4055b16
1 changed files with 18 additions and 11 deletions
|
@ -1282,9 +1282,16 @@ VALUE."
|
|||
(struct-ref obj (+ 1 vtable-offset-user))
|
||||
(error 'not-a-record-type obj)))
|
||||
|
||||
(define* (record-constructor rtd #:optional field-names)
|
||||
(if (not field-names)
|
||||
(struct-ref rtd (+ 2 vtable-offset-user))
|
||||
(define record-constructor
|
||||
(case-lambda
|
||||
((rtd)
|
||||
(struct-ref rtd (+ 2 vtable-offset-user)))
|
||||
((rtd field-names)
|
||||
(issue-deprecation-warning
|
||||
"Calling `record-constructor' with two arguments (the record type"
|
||||
" and a list of field names) is deprecated. Instead, call with just"
|
||||
" one argument, and provide a wrapper around that constructor if"
|
||||
" needed.")
|
||||
(primitive-eval
|
||||
`(lambda ,field-names
|
||||
(make-struct/no-tail ',rtd
|
||||
|
@ -1292,7 +1299,7 @@ VALUE."
|
|||
(if (memq f field-names)
|
||||
f
|
||||
#f))
|
||||
(record-type-fields rtd)))))))
|
||||
(record-type-fields rtd))))))))
|
||||
|
||||
(define (record-predicate rtd)
|
||||
(lambda (obj) (and (struct? obj) (eq? rtd (struct-vtable obj)))))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue