diff --git a/collects/mzlib/foreign.ss b/collects/mzlib/foreign.ss index 0d320ed..8c7ccf7 100644 --- a/collects/mzlib/foreign.ss +++ b/collects/mzlib/foreign.ss @@ -1466,12 +1466,15 @@ list->TYPE list*->TYPE TYPE->list TYPE->list*))))))) (define (identifiers? stx) (andmap identifier? (syntax->list stx))) - (define (_-identifier? stx) - (and (identifier? stx) - (regexp-match #rx"^_.+" (symbol->string (syntax-e stx))))) + (define (_-identifier? id stx) + (and (identifier? id) + (or (regexp-match #rx"^_." (symbol->string (syntax-e id))) + (raise-syntax-error #f "cstruct name must begin with a `_'" + stx id)))) (syntax-case stx () [(_ _TYPE ([slot slot-type] ...)) - (and (_-identifier? #'_TYPE) (identifiers? #'(slot ...))) + (and (_-identifier? #'_TYPE stx) + (identifiers? #'(slot ...))) (make-syntax #'_TYPE #f #'(slot ...) #'(slot-type ...))] [(_ (_TYPE _SUPER) ([slot slot-type] ...)) (and (_-identifier? #'_TYPE) (identifiers? #'(slot ...)))