ref: 5dff14b0bebf5aa06127beb54f964421cc57a2b9
parent: c313af9d46984f3315d402eb0583f96db0b4d7a1
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Tue Jun 18 21:14:20 EDT 2024
mkfield: protect against duplicate fields
--- a/otf.rkt
+++ b/otf.rkt
@@ -368,7 +368,9 @@
`name
(list (mkattr [~@ attrs]) ...))])
(begin
- (set! fields (append fields (list (syntax->datum #'(name type)))))
+ (when (assoc (syntax->datum #`name) fields)
+ (raise-syntax-error #f (~a "duplicate field") stx #'name))
+ (set! fields (cons (syntax->datum #'(name type)) fields))
f)))]))
(define-syntax (mkfields stx)