aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2023-10-18 03:04:12 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2023-10-18 03:04:12 +0200
commit6045e43a9a8099fc047acfde7beaa6fe8766a2e7 (patch)
tree77a2a359230c437209e8a5724c3bbd1fa0990e21 /doc
parentClarify keywordness for object field parameters. (diff)
downloadcalp-6045e43a9a8099fc047acfde7beaa6fe8766a2e7.tar.gz
calp-6045e43a9a8099fc047acfde7beaa6fe8766a2e7.tar.xz
Introduce keyword: to define-type.
Type fields like to be named after their containing type. But when creating new instances having to type the full name each time gets cumbersome. This allows local keywords for cleaner code.
Diffstat (limited to 'doc')
-rw-r--r--doc/ref/object/object.texi11
1 files changed, 11 insertions, 0 deletions
diff --git a/doc/ref/object/object.texi b/doc/ref/object/object.texi
index fd9cb533..fe8afc59 100644
--- a/doc/ref/object/object.texi
+++ b/doc/ref/object/object.texi
@@ -82,6 +82,17 @@ Each type introduces a number of bindings, which are@footnote{
}:
@end deffn
+@deffn {Field Parameter} #:keyword name
+Specify an alternative keyword to use for this parameter when creating
+new instances of the object. Note that @var{name} should be a bare
+symbol, and @emph{not} a keyword object.
+
+@example
+(define-type (my-type)
+ (my-type-x keyword: x))
+@end example
+@end deffn
+
@defun @var{<name>} [kv-args ...]
Type constructor. Takes key-value arguments. Where the keys are the
names of the fields.