aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2021-02-27 16:30:40 -0700
committerSean Whitton <spwhitton@spwhitton.name>2021-02-27 16:30:40 -0700
commit9b33466662cb1a8d1cd4c3fcb4803f7844eb7461 (patch)
tree26cf39f9fb16ac0c86d80b8ec691b06703aa3441
parentcb136f7ac479f9d398d731590caae03ed1f49c78 (diff)
downloadconsfigurator-9b33466662cb1a8d1cd4c3fcb4803f7844eb7461.tar.gz
plan for handling nested propspecs
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
-rw-r--r--doc/properties.rst6
-rw-r--r--doc/propspecs.rst34
2 files changed, 40 insertions, 0 deletions
diff --git a/doc/properties.rst b/doc/properties.rst
index 771ef77..7a1c299 100644
--- a/doc/properties.rst
+++ b/doc/properties.rst
@@ -1,6 +1,12 @@
Properties
==========
+Names
+-----
+
+The names of properties may not end in the character ``.``, because that has a
+special meaning in unevaluated property application specifications.
+
Property subroutines
--------------------
diff --git a/doc/propspecs.rst b/doc/propspecs.rst
index 7143f37..a3f8900 100644
--- a/doc/propspecs.rst
+++ b/doc/propspecs.rst
@@ -6,3 +6,37 @@ Combinators
Currently supported: ``(unapply (foo 1 2 3))``, ``((foo 1 2 3) on-change (bar
4 5 6) on-change (baz 7 8 9))`` and combinations thereof.
+
+Unevaluated property application specifications
+-----------------------------------------------
+
+In an atomic property application within an unevaluated property application
+specification, if the symbol naming the property ends with the character
+``.``, then the following special evaluation rules apply:
+
+1. The property to be applied is the property named by the symbol in the same
+ package and with the same name as the first element of the atomic property
+ application, but with the trailing period removed from the name.
+
+2. The first argument is not evaluated if it is a list whose first element is
+ a keyword, or a if it is a list of lists where the first element of the
+ first list is a keyword.
+
+3. The last argument is treated as an unevaluated property application
+ specification and is converted into a property application specification
+ according to the usual evaluation rules.
+
+This is intended to make applications of properties like DEPLOYS,
+DEPLOYS-THESE and CHROOT:DEBOOTSTRAPPED, which take property application
+specifications as arguments, easier to read and write in the most common
+cases. For example, you can write::
+
+ (deploys. (:ssh (:sudo :as "spwhitton@athena.example.com")) athena.example.com
+ ((additional-property val1)
+ (a-further-property val2)))
+
+instead of::
+
+ (deploys '(:ssh (:sudo :as "spwhitton@athena.example.com")) athena.example.com
+ `((additional-property ,val1)
+ (a-further-property ,val2)))