@@ -165,7 +165,7 @@ (define-maybe stem (no-serialization)))
(define (define-configuration-helper serialize? serializer-prefix syn)
(syntax-case syn ()
- ((_ stem (field (field-type def ...) doc custom-serializer ...) ...)
+ ((_ stem (field (field-type def) doc custom-serializer ...) ...)
(with-syntax (((field-getter ...)
(map (lambda (field)
(id #'stem #'stem #'- field))
@@ -205,9 +205,7 @@ (define-record-type* #,(id #'stem #'< #'stem #'>)
source-properties->location))
(innate))
#,@(map (lambda (name getter def)
- (if (unspecified? (syntax->datum def))
- #`(#,name #,getter)
- #`(#,name #,getter (default #,def))))
+ #`(#,name #,getter (default #,def)))
#'(field ...)
#'(field-getter ...)
#'(field-default ...)))
@@ -231,7 +229,13 @@ (define-syntax-rule (stem arg (... ...))
(let ((conf (#,(id #'stem #'% #'stem) arg (... ...))))
(validate-configuration conf
#,(id #'stem #'stem #'-fields))
- conf)))))))
+ conf)))))
+ ;; TODO This does not work, because it matches when *every* field is of
+ ;; this form.
+ ((_ stem (field (field-type) doc custom-serializer ...) ...)
+ (stem (field (field-type *unspecified*) doc custom-serializer ...) ...))
+ ((_ stem (field field-type doc custom-serializer ...) ...)
+ (stem (field (field-type *unspecified*) doc custom-serializer ...) ...))))
(define no-serialization ;syntactic keyword for 'define-configuration'
'(no serialization))
@@ -239,27 +243,19 @@ (define no-serialization ;syntactic keyword for 'define-configuration'
(define-syntax define-configuration
(lambda (s)
(syntax-case s (no-serialization prefix)
- ((_ stem (field (field-type def ...) doc custom-serializer ...) ...
- (no-serialization))
- (define-configuration-helper
- #f #f #'(_ stem (field (field-type def ...) doc custom-serializer ...)
- ...)))
- ((_ stem (field (field-type def ...) doc custom-serializer ...) ...
- (prefix serializer-prefix))
- (define-configuration-helper
- #t #'serializer-prefix #'(_ stem (field (field-type def ...)
- doc custom-serializer ...)
- ...)))
- ((_ stem (field (field-type def ...) doc custom-serializer ...) ...)
- (define-configuration-helper
- #t #f #'(_ stem (field (field-type def ...) doc custom-serializer ...)
- ...))))))
+ ((_ stem fields ... (no-serialization))
+ (define-configuration-helper #f #f
+ #'(_ stem fields ...)))
+ ((_ stem fields ... (prefix serializer-prefix))
+ (define-configuration-helper #t #'serializer-prefix
+ #'(_ stem fields ...)))
+ ((_ stem fields ...)
+ (define-configuration-helper #t #f
+ #'(_ stem fields ...))))))
(define-syntax-rule (define-configuration/no-serialization
- stem (field (field-type def ...)
- doc custom-serializer ...) ...)
- (define-configuration stem (field (field-type def ...)
- doc custom-serializer ...) ...
+ stem (field type-and-def doc custom-serializer ...) ...)
+ (define-configuration stem (field type-and-def doc custom-serializer ...) ...
(no-serialization)))
(define (empty-serializer field-name val) "")