]> gitweb.factorcode.org Git - factor.git/commitdiff
combinators: move docs for recursive-hashcode.
authorJohn Benediktsson <mrjbq7@gmail.com>
Thu, 15 Oct 2020 22:33:36 +0000 (15:33 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Thu, 15 Oct 2020 22:33:58 +0000 (15:33 -0700)
core/combinators/combinators-docs.factor
core/kernel/kernel-docs.factor

index d9ce8234f64d10576754aa41f43a13530503da18..b44e67408b7d01bde8981dc49d9a23151e8a1a64 100644 (file)
@@ -373,10 +373,6 @@ HELP: no-case
 { $description "Throws a " { $link no-case } " error." }
 { $error-description "Thrown by " { $link case } " if the object at the top of the stack does not match any case, and no default case is given." } ;
 
-HELP: recursive-hashcode
-{ $values { "n" integer } { "obj" object } { "quot" { $quotation ( n obj -- code ) } } { "code" integer } }
-{ $description "A combinator used to implement methods for the " { $link hashcode* } " generic word. If " { $snippet "n" } " is less than or equal to zero, outputs 0, otherwise calls the quotation." } ;
-
 HELP: deep-spread>quot
 { $values { "seq" sequence } { "quot" quotation } }
 { $description "Creates a new quotation from a sequence of quotations that applies each quotation to a stack element in turn." }
index d06c764758217ce331fb07797f657879003bfabf..c2595737f07b54527a8dd4338e99d3e6791b46a1 100644 (file)
@@ -97,8 +97,6 @@ HELP: hashcode*
 { $contract "Outputs the hashcode of an object. The hashcode operation must satisfy the following properties:"
 { $list
     { "If two objects are equal under " { $link = } ", they must have equal hashcodes." }
-    { "If the hashcode of an object depends on the values of its slots, the hashcode of the slots must be computed recursively by calling " { $link hashcode* } " with a " { $snippet "level" } " parameter decremented by one. This avoids excessive work while still computing well-distributed hashcodes. The " { $link recursive-hashcode } " combinator can help with implementing this logic," }
-    { "The hashcode should be a " { $link fixnum } ", however returning a " { $link bignum } " will not cause any problems other than potential performance degradation." }
     { "The hashcode is only permitted to change between two invocations if the object or one of its slot values was mutated." }
 }
 "If mutable objects are used as hashtable keys, they must not be mutated in such a way that their hashcode changes. Doing so will violate bucket sorting invariants and result in undefined behavior. See " { $link "hashtables.keys" } " for details." } ;
@@ -107,6 +105,10 @@ HELP: hashcode
 { $values { "obj" object } { "code" fixnum } }
 { $description "Computes the hashcode of an object with a default hashing depth. See " { $link hashcode* } " for the hashcode contract." } ;
 
+HELP: recursive-hashcode
+{ $values { "n" integer } { "obj" object } { "quot" { $quotation ( n obj -- code ) } } { "code" integer } }
+{ $description "A combinator used to implement methods for the " { $link hashcode* } " generic word. If " { $snippet "n" } " is less than or equal to zero, outputs 0, otherwise calls the quotation." } ;
+
 HELP: identity-hashcode
 { $values { "obj" object } { "code" fixnum } }
 { $description "Outputs the identity hashcode of an object. The identity hashcode is not guaranteed to be unique, however it will not change during the object's lifetime." } ;