summaryrefslogtreecommitdiff
path: root/def.lisp
diff options
context:
space:
mode:
Diffstat (limited to 'def.lisp')
-rw-r--r--def.lisp9
1 files changed, 6 insertions, 3 deletions
diff --git a/def.lisp b/def.lisp
index 715ab7f..aea5bb9 100644
--- a/def.lisp
+++ b/def.lisp
@@ -47,6 +47,7 @@ have an value after them, all flags must come before other options. Flags are:
:prefix - prefix the accessor by the class name
:ro - only define a reader
:wo - only define a writer
+ :noarg - means no initarg
By default an accessor is defined.
@@ -64,14 +65,15 @@ E.g.
(intern (format nil "~a-~a" name slot))
slot))
(singlep (x)
- (find x '(:prefix :ro :wo) :test #'eq))
+ (find x '(:prefix :ro :wo :noarg) :test #'eq))
(parse-slot-spec-expr (expr)
" (names ... &key kwargs)"
(multiple-value-bind (slot-names kwargs) (take-until #'keywordp expr)
(multiple-value-bind (singles kwargs) (partition #'singlep kwargs)
(let ((prefix-accessor? (find ':prefix singles :test #'eq))
(read-only? (find ':ro singles :test #'eq))
- (write-only? (find ':wo singles :test #'eq)))
+ (write-only? (find ':wo singles :test #'eq))
+ (no-arg? (find ':noarg singles :test #'eq)))
(assert (not (and read-only? write-only?)) ()
"A slot cannot be both read-only (:ro) and write-only (:wo).")
(loop
@@ -81,7 +83,8 @@ E.g.
:for slot :in slot-names
:collect `(,slot
,accessor-type ,(make-accessor-name slot prefix-accessor?)
- :initarg ,(alexandria:make-keyword slot)
+ ,@(unless no-arg?
+ (list :initarg (alexandria:make-keyword slot)))
,@kwargs))))))
(parse-class-options (kwargs)