diff options
Diffstat (limited to 'txr.1')
-rw-r--r-- | txr.1 | 79 |
1 files changed, 66 insertions, 13 deletions
@@ -51064,15 +51064,18 @@ entries disappear. This happens even if the values are themselves reachable. Vice versa, when an object appearing as a value in one or more weak-value hash tables becomes unreachable, those entries disappear, even if the keys are reachable. When a hash table has both weak keys and weak values, then an -entry is removed when neither its key nor its value is reachable. In other -words, if either the key or value is reachable, the entry is retained. -Note: this behavior differed in \*(TX 266 and earlier versions. +the behavior is one of two possible semantics. Under the +.codn or -semantics, +the hash table entry is removed if either the key or the value is unreachable. +Under the +.codn and -semantics, +the entry is removed only if both the key and value are unreachable. If the keys of a weak-key hash table are reachable from the values, or if the values of a weak-key hash table are reachable from the keys, then the weak semantics is defeated for the affected entries: the hash table retains those entries as if it were an ordinary table. A hash table with both weak keys and -values does not have this issue. +values does not have this issue, regardless of its semantics. An open traversal of a hash table is performed by the .code maphash @@ -51123,7 +51126,7 @@ becomes unspecified. These functions construct a new hash table. .code make-hash -takes three mandatory Boolean arguments. The +takes three mandatory Boolean arguments. The Boolean .meta weak-keys argument specifies whether the hash table shall have weak keys. The .meta weak-vals @@ -51131,6 +51134,39 @@ argument specifies whether it shall have weak values, and .meta equal-based specifies whether it is .codn equal -based. + +If the +.meta weak-keys +argument is one of the keywords +.code :weak-and +or +.code :weak-or +then the hash table shall have both weak keys and weak values, with the +semantics implied by the keyword: +.code :weak-and +specifies +.codn and -semantics +and +.code :weak-or +specifies +code or -semantics. +The +.meta weak-vals +argument is then ignored. + +If both +.meta weak-keys +and +.meta weak-values +are true, and +.meta weak-keys +is not one of the keywords +.code :weak-and +or +.codn :weak-or , +then the hash table has +.codn or -semantics. + The .code hash function defaults all three of these properties to false, @@ -51159,6 +51195,8 @@ function provides an alternative interface. It accepts optional keyword arguments. The supported keyword symbols are: .codn :weak-keys , .codn :weak-vals , +.codn :weak-and , +.codn :weak-or , .codn :equal-based , .code :eql-based .code :eq-based @@ -51185,11 +51223,33 @@ function produces an hash table by default. If -.code :weak-keys +.codn :weak-keys , +.code :weak-and +or +.code :weak-or is specified, then .code :equal-based may not be specified. +At most one of +.code :weak-and +or +.code :weak-or +may be specified. If either of these is specified, then the +.code :weak-keys +and +.code :weak-values +keywords are redundant and unnecessary. + +If +.code :weak-keys +and +.code :weak-values +are both specified, and +.code :weak-and +isn't specified, the situation is equivalent to +.codn :weak-or . + If .code :userdata is present, it must be followed by an argument value; that value @@ -83088,13 +83148,6 @@ 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 266 -Until \*(TX 266, hash tables with both weak values and keys are subject to -a conjunctive rule for entry retention: entries are retained if both the -key and value are reachable objects. If either the key or value is unreachable, -the entry is eligible for removal. The behavior changed in favor of a disjunctive -rule: the hash entry is retained if either the key or value is reachable. -A compatibility option value of 266 or lower restores the old behavior. .IP 265 Until \*(TX 265, the .code with-resources |