--- This message is a formal comment which was submitted to formal-comment_at_r6rs.org, following the requirements described at: http://www.r6rs.org/process.html --- Sorry, the header of the previous mail was messed up (surely my typing M-q). submitter's name: Daniel Villeneuve submitter's email address: daniel_villeneuve_at_sympatico.ca type of issue: enhancement priority: minor R6RS component: Hash Tables version of the report: 5.92 SUMMARY The specification of hash-table-hash-function should not force implementations to return #f when something more useful is available. DESCRIPTION Quoting from http://www.r6rs.org/r6rs-editors/2006-March/001047.html, one can see that there were some arguments about the behavior of hash-table-hash-function for hash tables built from make-eq-hash-table and make-eqv-hash-table: <quote> >>Procedure: hash-table-hash-function hash-table => procedure >> >> Returns the hash function used by hash-table. > > > Should these procedures be defined on hash tables that > were created by calling make-eq-hash-table or > make-eqv-hash-table? You're right that hash-table-hash-function shouldn't be, so I've added provisional language to that effect. </quote> The current wording on page 52 requires that hash-table-hash-function return #f for such tables. I find some problems with this: a) This situation prevents implementations that can return useful functions to do so. b) This inhibits having a complete "hash-table-clone" method, which I think is one of the most useful usages for such inspection methods: (define (hash-table-clone ht k) (make-hash-table (hash-table-hash-function ht) (hash-table-equivalence-function ht) k)) c) On systems that provide users with public hash-eq and hash-eqv functions, the current wording forces the implementation to remember if a hash table was built using (make-eq-hash-table) or (make-hash-table hash-eq eq?), just for the sake of complying with the hash-table-hash-function's spec. PROPOSAL Alternative 1: on hash tables built using make-eq-hash-table and make-eqv-hash-table, hash-table-hash-function can return the implementation's choice of hash-function if this is available, or #f otherwise. This addresses issues a) and c), but not b). Alternative 2: hash-table-hash-function should always return a function, suitable to be used as a hash function by make-hash-table. For tables built using make-eq-hash-table and make-eqv-hash-table, the returned function can throw an exception if invoked. This addresses issues a), b) and c). -- Daniel VilleneuveReceived on Sat Feb 17 2007 - 17:57:23 UTC
This archive was generated by hypermail 2.3.0 : Wed Oct 23 2024 - 09:15:01 UTC