diff options
-rw-r--r-- | doc/propspecs.rst | 13 | ||||
-rw-r--r-- | src/combinator.lisp | 13 | ||||
-rw-r--r-- | src/package.lisp | 1 | ||||
-rw-r--r-- | src/property.lisp | 20 | ||||
-rw-r--r-- | src/property/os.lisp | 2 |
5 files changed, 28 insertions, 21 deletions
diff --git a/doc/propspecs.rst b/doc/propspecs.rst index b3d4d39..8d915b5 100644 --- a/doc/propspecs.rst +++ b/doc/propspecs.rst @@ -26,12 +26,13 @@ Definitions An *atomic property application* ("propapp") is a list satisfying the lambda list ``(PROPERTY &rest ARGS)`` where ``PROPERTY`` is a symbol naming a -property and ``ARGS`` satisfies that property's lambda list. A *property -combinator* is a function which takes at least one propapp as one of its -arguments and returns a single propapp, or a macro which takes at least -propapp as one of its arguments and returns an expression which yields a -single propapp (in the return values of property combinators, often -``PROPERTY`` will be a gensym). A *property application specification* is +property and ``ARGS`` satisfies that property's lambda list, or the empty +list, which means a no-op property. A *property combinator* is a function +which takes at least one propapp as one of its arguments and returns a single +propapp, or a macro which takes at least propapp as one of its arguments and +returns an expression which yields a single propapp (in the return values of +property combinators, often ``PROPERTY`` will be a gensym). A *property +application specification* is i. a readably printable Lisp expression, **P**, known as a *property application specification expression*, which contains diff --git a/src/combinator.lisp b/src/combinator.lisp index a67bba8..f782367 100644 --- a/src/combinator.lisp +++ b/src/combinator.lisp @@ -20,11 +20,6 @@ ;;;; Property combinators -(defprop noop :posix (&rest args) - "A property which accepts any number of arguments and does nothing." - (:desc (declare (ignore args)) "No-op property") - (:hostattrs (declare (ignore args)))) - (defmacro define-function-property-combinator (name args &body body) (multiple-value-bind (forms declarations docstring) (parse-body body :documentation t) @@ -107,8 +102,12 @@ apply the elements of REQUIREMENTS in reverse order." ;; should not be returned by property subroutines, per the spec (defun apply-and-print (propapps &optional unapply) (flet ((paa (pa) (if unapply (propappunapply pa) (propappapply pa)))) - (let ((ret :no-change)) - (dolist (pa (if unapply (reverse propapps) propapps) ret) + (let ((ret :no-change) + ;; Remove any null propapps because we don't want to print anything + ;; for those, and applying them will do nothing. + (propapps + (remove-if #'null (if unapply (reverse propapps) propapps)))) + (dolist (pa propapps ret) (let* ((announce (not (get (get (car pa) 'combinator) 'inline-combinator))) ;; TODO Nested combinators can mean that we establish this diff --git a/src/package.lisp b/src/package.lisp index 111312a..fd6ec12 100644 --- a/src/package.lisp +++ b/src/package.lisp @@ -143,7 +143,6 @@ #:append-propspecs ;; combinator.lisp - #:noop #:define-function-property-combinator #:define-choosing-property-combinator #:seqprops diff --git a/src/property.lisp b/src/property.lisp index 175f7dd..33b9e71 100644 --- a/src/property.lisp +++ b/src/property.lisp @@ -59,7 +59,9 @@ (get prop 'preprocess (lambda (&rest args) args))) (defun propapptype (propapp) - (get (car propapp) 'ptype)) + (if propapp + (get (car propapp) 'ptype) + :posix)) (defun collapse-types (&rest lists) (if (member :posix (flatten lists)) :posix :lisp)) @@ -68,7 +70,8 @@ (apply (get prop 'desc #'noop) args)) (defun propappdesc (propapp) - (apply #'propdesc propapp)) + (when propapp + (apply #'propdesc propapp))) (defun proplambda (prop) (get prop 'plambda)) @@ -77,13 +80,14 @@ (apply (get prop 'hostattrs #'noop) args)) (defun propappattrs (propapp) - (apply #'propattrs propapp)) + (when propapp + (apply #'propattrs propapp))) (defun propcheck (prop &rest args) (apply (get prop 'check #'noop) args)) (defun propappcheck (propapp) - (apply #'propcheck propapp)) + (if propapp (apply #'propcheck propapp) t)) (defmacro with-some-errors-are-failed-change (&body forms) `(handler-case (progn ,@forms) @@ -98,7 +102,9 @@ (apply (get prop 'papply (constantly :no-change)) args))))) (defun propappapply (propapp) - (apply #'propapply propapp)) + (if propapp + (apply #'propapply propapp) + :no-change)) (defun propunapply (prop &rest args) (with-some-errors-are-failed-change @@ -108,7 +114,9 @@ (apply (get prop 'unapply (constantly :no-change)) args))))) (defun propappunapply (propapp) - (apply #'propappunapply propapp)) + (if propapp + (apply #'propappunapply propapp) + :no-change)) (defvar *known-properties* nil "All properties whose definitions have been loaded.") diff --git a/src/property/os.lisp b/src/property/os.lisp index d1aeb2b..aceb24e 100644 --- a/src/property/os.lisp +++ b/src/property/os.lisp @@ -99,7 +99,7 @@ (define-choosing-property-combinator os-typecase* (host &rest cases) :type (typecase-type cases) - :choose (or (typecase-choose host cases) '(noop))) + :choose (typecase-choose host cases)) (define-choosing-property-combinator os-etypecase* (host &rest cases) :type (typecase-type cases) |