chiark / gitweb /
src/c-types-impl.lisp: Reorder `merge-keyword-lists' input lists.
[sod] / src / pset-proto.lisp
index eaf3a7732e08d7d7c90b738ed2d7448d369598b9..61793b5c5b5359e627be620265387431b212bd4d 100644 (file)
@@ -55,11 +55,11 @@ (defstruct (property
    distinctly about identifiers, strings and symbols, and we've only got two
    obvious Lisp types to play with.  Sad, but true."
 
-  (name nil :type (or string symbol))
-  (value nil :type t)
-  (%type nil :type symbol)
-  (location (file-location nil) :type file-location)
-  (key nil :type symbol)
+  (name nil :type (or string symbol) :read-only t)
+  (value nil :type t :read-only t)
+  (%type nil :type symbol :read-only t)
+  (location (file-location nil) :type file-location :read-only t)
+  (key nil :type symbol :read-only t)
   (seenp nil :type boolean))
 (define-access-wrapper p-type p-%type :read-only t)
 
@@ -72,7 +72,8 @@ (defgeneric decode-property (raw)
   (:method ((raw character)) (values :char raw))
   (:method ((raw property)) (values (p-type raw) (p-value raw)))
   (:method ((raw cons)) (values (car raw) (cdr raw)))
-  (:method ((raw function)) (values :func raw)))
+  (:method ((raw function)) (values :func raw))
+  (:method ((raw c-type)) (values :type raw)))
 
 (export 'make-property)
 (defun make-property (name raw-value &key type location seenp)
@@ -316,7 +317,8 @@ (defmacro default-slot-from-property
    We initialize SLOT in INSTANCE.  In full: if PSET contains a property
    called NAME, then convert it to TYPE, bind the value to PVAR and evaluate
    CONVERT-FORMS -- these default to just using the property value.  If
-   there's no property, and the slot is named in SLOT-NAMES and currently
+   there's no property, and DEFAULT-FORMS contains at least one non-
+   declaration form, and the slot is named in SLOT-NAMES and currently
    unbound, then evaluate DEFAULT-FORMS and use their value to compute the
    slot value."
 
@@ -332,7 +334,8 @@ (defmacro default-slot-from-property
               (setf (slot-value ,instance ,slot)
                     (with-default-error-location (,floc)
                       ,@(or convert-forms `(,pvar))))
-              (default-slot (,instance ,slot ,slot-names)
-                ,@body)))))))
+              ,@(and body
+                     `((default-slot (,instance ,slot ,slot-names)
+                         ,@body)))))))))
 
 ;;;----- That's all, folks --------------------------------------------------