(define-feature 'srfi-39 always) ;Parameter objects
(define-feature 'srfi-62 always) ;S-expression comments
(define-feature 'srfi-69 always) ;Basic Hash Tables
+(define-feature 'srfi-131 always) ;ERR5RS Record Syntax (reduced)
(define ((os? value))
(eq? value microcode-id/operating-system))
(%make-record-type type-name field-specs #f)
(begin
(guarantee record-type? parent-type 'new-make-record-type)
- (let ((field-specs
- (append (record-type-field-specs parent-type)
- field-specs)))
- (if (duplicate-fields? field-specs)
- (error "Overlap between child and parent fields:"
- field-specs))
- (%make-record-type type-name field-specs parent-type))))))
+ (%make-record-type type-name
+ (append (record-type-field-specs parent-type)
+ field-specs)
+ parent-type)))))
(define (%make-record-type type-name field-specs parent-type)
(letrec*
(define record-updater record-modifier)
(define (record-type-field-index record-type name error?)
- (let* ((names (%record-type-field-names record-type))
- (n (vector-length names)))
- (let loop ((i 0))
- (if (fix:< i n)
+ (let ((names (%record-type-field-names record-type)))
+ ;; Search from end because a child field must override an ancestor field of
+ ;; the same name.
+ (let loop ((i (fix:- (vector-length names) 1)))
+ (if (fix:>= i 0)
(if (eq? (vector-ref names i) name)
(fix:+ i 1)
- (loop (fix:+ i 1)))
+ (loop (fix:- i 1)))
(and error?
(record-type-field-index record-type
(error:no-such-slot record-type name)