[MLton-commit] r6378
Vesa Karvonen
vesak at mlton.org
Mon Feb 4 09:19:48 PST 2008
Updated comments.
----------------------------------------------------------------------
U mltonlib/trunk/com/ssh/generic/unstable/public/value/hash.sig
----------------------------------------------------------------------
Modified: mltonlib/trunk/com/ssh/generic/unstable/public/value/hash.sig
===================================================================
--- mltonlib/trunk/com/ssh/generic/unstable/public/value/hash.sig 2008-02-04 16:44:11 UTC (rev 6377)
+++ mltonlib/trunk/com/ssh/generic/unstable/public/value/hash.sig 2008-02-04 17:19:47 UTC (rev 6378)
@@ -1,4 +1,4 @@
-(* Copyright (C) 2007 SSH Communications Security, Helsinki, Finland
+(* Copyright (C) 2007-2008 SSH Communications Security, Helsinki, Finland
*
* This code is released under the MLton license, a BSD-style license.
* See the LICENSE file or http://mlton.org/License for details.
@@ -7,19 +7,25 @@
(**
* Signature for a generic hash function.
*
+ * Values of different types usually hash to different words. This seems
+ * important for some generic algorithms and is achieved by mixing a value
+ * specific hash with a hash of the type encoding obtained using the
+ * {TypeHash} generic.
+ *
* Standard ML does not provide a means to extract the identity of a
* mutable object as a hashable value. This means that, regardless of
- * identity, two structurally equivalent mutable objects always hash to
- * the same word, which can degrade the asymptotic time complexity of
- * algorithms that hash mutable objects.
+ * identity, two mutable objects of the same type (or type encoding)
+ * always hash to the same word, which can degrade the asymptotic time
+ * complexity of algorithms that hash mutable objects.
*
- * Interestingly, hashing pure functions is possible. More precisely, it
- * is possible to implement a non-trivial mapping - whose range is not a
- * singleton - of pure functions to words in such a way that equivalent
- * functions map to equal words. This requires the ability to generate
- * values from the domains of functions. However, it makes little sense
- * to provide such functionality solely for the purpose of hashing
- * functions, because it is impossible to compare functions for equality.
+ * Interestingly, hashing pure functions is possible, although it isn't
+ * supported by the {Hash} generic. More precisely, it is possible to
+ * implement a non-trivial mapping - whose range is not a singleton - of
+ * pure functions to words in such a way that equivalent functions map to
+ * equal words. This requires the ability to generate values from the
+ * domains of functions. However, it makes little sense to provide such
+ * functionality solely for the purpose of hashing functions, because it
+ * is impossible to compare functions for equality.
*)
signature HASH = sig
structure HashRep : OPEN_REP
More information about the MLton-commit
mailing list