From ef05115ea1d7e6c366c7ae5d38dc823830f2ce70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Kochma=C5=84ski?= Date: Mon, 7 Oct 2019 09:36:35 +0200 Subject: [PATCH] def-clx-class: allow only options valid for both structs and classes This change assures that def-clx-class is always valid for any value of *def-clx-class-use-defclass*. That allows us to catch early issues which otherwise may be undetected for a long time. --- depdefs.lisp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/depdefs.lisp b/depdefs.lisp index 56d2868..ebf78ff 100644 --- a/depdefs.lisp +++ b/depdefs.lisp @@ -542,9 +542,15 @@ used, since NIL is the empty list.") ,(closintern 'print-object) ((object ,name) stream) (,print-function object stream 0)))))))) - `(within-definition (,name def-clx-class) - (defstruct (,name ,@options) - ,@slots)))) + (flet ((assert-valid-option (option) + (unless (typep option + '(cons (member :constructor :include + :print-function :copier :predicate))) + (error "~s: invalid option ~s." 'def-clx-class option)))) + (mapc #'assert-valid-option options) + `(within-definition (,name def-clx-class) + (defstruct (,name ,@options) + ,@slots))))) #+Genera (progn