summaryrefslogtreecommitdiffstats
path: root/txr.1
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-07-07 06:37:58 -0700
committerKaz Kylheku <kaz@kylheku.com>2021-07-07 06:37:58 -0700
commit7375b5a42a77eeb3ac3f085b3d026adbb93ad5a9 (patch)
tree399d56dfe53a8ac4c9e89f6c75c6e447d2dacddd /txr.1
parent381ed03066f89602011d82892fe59d4dfff07e00 (diff)
downloadtxr-7375b5a42a77eeb3ac3f085b3d026adbb93ad5a9.tar.gz
txr-7375b5a42a77eeb3ac3f085b3d026adbb93ad5a9.tar.bz2
txr-7375b5a42a77eeb3ac3f085b3d026adbb93ad5a9.zip
with-resources: undocumented nil skip behavior.
Paul A. Patience discovered the hidden "feature" of with-resourcers, that the three-argument form of the binding (var init cleanup) causes the with-resources form to terminate if init returns nil. The (var init) syntax doesn't generate this logic. * stdlib/with-resources.tl (with-resources): Do not emit the when form unless <= 265 compatibility is in effect. * tests/012/oop-mac.tl: New file. * txr.1: Compat note added.
Diffstat (limited to 'txr.1')
-rw-r--r--txr.131
1 files changed, 29 insertions, 2 deletions
diff --git a/txr.1 b/txr.1
index 363fedf8..9d5ae2b1 100644
--- a/txr.1
+++ b/txr.1
@@ -47841,6 +47841,14 @@ if no
.metn body-form s
are present.
+.TP* Note:
+
+From its inception, until \*(TX 265,
+.code with-resources
+featured an undocumented behavior. Details are given in the
+COMPATIBILITY section's Compatibility Version Values subsection,
+in the notes for compatibility value 265.
+
.TP* "Example:"
The following expression opens a text file and reads a line from it,
@@ -47853,8 +47861,6 @@ immediately:
(put-line l)))
.brev
-
-
.coNP Special variable @ *unhandled-hook*
The
.code *unhandled-hook*
@@ -82755,6 +82761,27 @@ of these version values, the described behaviors are provided if
is given an argument which is equal or lower. For instance
.code "-C 103"
selects the behaviors described below for version 105, but not those for 102.
+.IP 265
+Until \*(TX 265, the
+.code with-resources
+macro exhibits an undocumented behavior: the three-element binding expression
+.mono
+.meti >> ( var < init << cleanup )
+.onom
+immediately causes the
+.code with-resources
+form to terminate with a return value of
+.code nil
+if the
+.meta init
+form returns
+.codn nil .
+Neither the
+.meta cleanup
+in the same expression, nor any subsequent binding expressions or the body
+of the construct, are evaluated. Prior cleanup forms are evaluated in
+reverse order, as documented. A compatibility value of 265 or less restores
+this behavior.
.IP 262
Selection 262 compatibility restores a wrong behavior which existed between
versions 191 and 262 due to a regression. The wrong behavior is that the