Skip to content

Commit

Permalink
def-clx-class: allow only options valid for both structs and classes
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
dkochmanski committed Oct 7, 2019
1 parent f0060af commit ef05115
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions depdefs.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ef05115

Please sign in to comment.