diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2017-12-28 17:41:28 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2017-12-28 17:41:28 -0800 |
commit | 079cf1d067ec21e590f0ec025cbc282f8290e2fa (patch) | |
tree | 9cc6bd45acdbe94fc4e9532c0813c9c78d00f39e /txr.1 | |
parent | 239dac3bdcc993690227839899bde3d861d756ed (diff) | |
download | txr-079cf1d067ec21e590f0ec025cbc282f8290e2fa.tar.gz txr-079cf1d067ec21e590f0ec025cbc282f8290e2fa.tar.bz2 txr-079cf1d067ec21e590f0ec025cbc282f8290e2fa.zip |
hash: read/print consistency regression.
TXR 188 makes a slight mess of the #H notation. An :eql-based
hash table prints as #H(() ...), but when that notation is
read, it produces an :equal-based hash table. No aspect of
this situation was intended; the intent was that the notation
stays the same as before, and just the hash function changes
to make :equal-based the default. Let's just go with this
and have #H(() ...) denote :equal-based tables.
* hash.c (hash_print_op): Print an :eql-based for eql-based
hash tables, and nothing for equal-based ones. In
compatibility mode with 188 and older, reproduce the old
behavior, rendering equal-based tables with :equal-based and
the absence of a symbol for eql-based.
* txr.1: Updated places that touch on :equal-based and
added compatibility notes.
* tests/009/json.expected: updated, since equal-based hash
tables now print without :equal-based keyword.
Diffstat (limited to 'txr.1')
-rw-r--r-- | txr.1 | 33 |
1 files changed, 26 insertions, 7 deletions
@@ -11288,13 +11288,13 @@ Hash table literals have two parts: the list of hash construction arguments and the key-value pairs. For instance: .cblk - #H((:equal-based) (a 1) (b 2)) + #H((:eql-based) (a 1) (b 2)) .cble where -.code (:equal-based) +.code (:eql-based) indicates that this hash table's keys are treated using -.code equal +.code eql equality, and .code "(a 1)" and @@ -11306,7 +11306,7 @@ hash: .cblk ;; not supported: splicing across the entire syntax - (let ((hash-syntax '((:equal-based) (a 1) (b 2)))) + (let ((hash-syntax '((:eql-based) (a 1) (b 2)))) ^#H(,*hash-syntax)) .cble @@ -11314,7 +11314,7 @@ This is correct: .cblk ;; fine: splicing hash arguments and contents separately - (let ((hash-args '(:equal-based)) + (let ((hash-args '(:eql-based)) (hash-contents '((a 1) (b 2)))) ^#H(,hash-args ,*hash-contents)) .cble @@ -11840,7 +11840,7 @@ are not supported. .TP* "Note:" Circular notation can span hash table literals. The syntax -.code "#1=#H(() (#1# #1#))" +.code "#1=#H((:eql-based) (#1# #1#))" denotes an .codn eql -based hash table which contains one entry, in which that @@ -11848,7 +11848,7 @@ same table itself is both the key and value. This kind of circularity is not supported for .codn equal -based hash tables. The analogous syntax -.code "#1=#H((:equal-based) (#1# #1#))" +.code "#1=#H(() (#1# #1#))" produces a hash table in an inconsistent state. .TP* "Dialect note:" @@ -62690,6 +62690,25 @@ 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 188 +Until \*(TX 188, +.codn equal -based +hash tables printed using the notation +.code "#H((:equal-based ...) ...)" +whereas +.codn eql -based +hash tables simply omitted the +.code :equal-based +keyword. Changes were introduced in \*(TX 187 which gave rise to a read/print +inconsistency with printing behavior. In \*(TX 189, further changes were +introduced to fix this inconsistency: +.codn equal -based +hash tables print without any keyword indicating equality, and +.codn eql -based +hash tables print as +.codn "#H((:eql-based) ...)" . +If 188 or compatibility is selected, hash tables are printed +in the old way. .IP 187 Until \*(TX 187, hash tables constructed by the .code hash |