summaryrefslogtreecommitdiffstats
path: root/txr.1
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2022-10-11 23:05:16 -0700
committerKaz Kylheku <kaz@kylheku.com>2022-10-11 23:05:16 -0700
commit2cda9b946d701faa308b0915c83ea48fb94d94af (patch)
treea546879daba90dfd65fc370ab1e03475f7778d77 /txr.1
parentaa02bc7f31edabb9e09f9756d7ae8fbc41995017 (diff)
downloadtxr-2cda9b946d701faa308b0915c83ea48fb94d94af.tar.gz
txr-2cda9b946d701faa308b0915c83ea48fb94d94af.tar.bz2
txr-2cda9b946d701faa308b0915c83ea48fb94d94af.zip
structs: optional init-exprs now useful in :delegate
* stdlib/struct.tl (:delegate): Handle the two-element form of the optional parameter, which specifies the usual initializing expression for the default value. This is just passed through as-is to the generated method. Diagnose if the three-element form occurs. * tests/012/oop.tl: Some new tests. * txr.1: Documented.
Diffstat (limited to 'txr.1')
-rw-r--r--txr.138
1 files changed, 30 insertions, 8 deletions
diff --git a/txr.1 b/txr.1
index 846c35d4..e3cdf0a5 100644
--- a/txr.1
+++ b/txr.1
@@ -32025,16 +32025,38 @@ must be an expression which the delegate method can evaluate to
produce a delegate object. The delegate method then passes its
arguments to the target method, given by the
.meta target-name
-argument, invoked on the delegate object. If the delegate method has optional
-parameters which have not received an argument value, those parameters
-are treated as if they had received the colon symbol
+argument, invoked on the delegate object.
+
+If the delegate method specifies an optional parameter without a default
+initializing expression, and that optional parameter
+is not given an argument value, it receives the colon symbol
.code :
-as their value, and that value is passed on. If the delegate method has
-variadic parameters, they are applied to the target. If optional parameters
-specified in
+as its argument. That value is passed on to the corresponding parameter
+of the delegate target method. Thus, if the target method has
+an optional parameter in that same parameter position, that colon symbol
+argument then has the effect of requesting the default value.
+If the target method has an ordinary parameter in that position, then
+the colon symbol is received as an ordinary argument value.
+
+If the delegate method specifies an optional parameter with a default
+initializing expression, and that optional parameter is not given
+an argument value, then the expression is evaluated to produce a value
+for that parameter, in the usual manner, and that value is passed as
+an argument to the corresponding parameter of the delegate target.
+Thus, delegates are able to specify different optional argument defaulting
+from their targets.
+
+A delegate may have an optional parameter in a position where the target
+has a required parameter and vice versa.
+
+The three-element optional parameter expression, specifying a Boolean variable
+which indicates whether the optional parameter has been given an argument, is
+not supported by the
.code :delegate
-are given argument values, those are discarded, playing no role in the
-delegation.
+clause, and is diagnosed.
+
+If the delegate method has variadic parameters, they are passed on to the
+target after the fixed parameters.
.TP* Example: