# HG changeset patch # User Steve Losh # Date 1595808683 14400 # Node ID aee9ba1c4913b4c7417498556a5ded665261dbe1 # Parent 54ec08936d37874c40e996b3f11eae64e534114d Fix defclass* to accept non-standard slot options diff -r 54ec08936d37 -r aee9ba1c4913 src/clos.lisp --- a/src/clos.lisp Sun Jul 26 20:11:01 2020 -0400 +++ b/src/clos.lisp Sun Jul 26 20:11:23 2020 -0400 @@ -1,23 +1,17 @@ (in-package :losh.clos) (defun build-slot-definition (conc-name slot-spec) - (destructuring-bind (name &key - (type nil type?) - (documentation nil documentation?) - (initform nil initform?) - (allocation nil allocation?) - (accessor (if conc-name - (symb conc-name name) - name)) - (initarg (ensure-keyword name))) - (ensure-list slot-spec) + (destructuring-bind (name &rest slot-options) (ensure-list slot-spec) `(,name - :initarg ,initarg - :accessor ,accessor - ,@(when initform? `(:initform ,initform)) - ,@(when allocation? `(:allocation ,allocation)) - ,@(when type? `(:type ,type)) - ,@(when documentation? `(:documentation ,documentation))))) + ,@(unless (getf slot-options :initarg) + `(:initarg ,(ensure-keyword name))) + ,@(unless (or (getf slot-options :reader) + (getf slot-options :writer) + (getf slot-options :accessor)) + `(:accessor ,(if conc-name + (symb conc-name name) + name))) + ,@slot-args))) (defmacro defclass* (name-and-options direct-superclasses slots &rest options) "`defclass` without the tedium.