From 079cf1d067ec21e590f0ec025cbc282f8290e2fa Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Thu, 28 Dec 2017 17:41:28 -0800 Subject: 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. --- txr.1 | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) (limited to 'txr.1') diff --git a/txr.1 b/txr.1 index eefbb678..f948f155 100644 --- a/txr.1 +++ b/txr.1 @@ -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 -- cgit v1.2.3