emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Hash values of symbols: why look at the name?


From: Daniel Colascione
Subject: Hash values of symbols: why look at the name?
Date: Mon, 15 Sep 2014 17:19:02 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.1.1

Right now, this form always evaluates to t:

  (eql (sxhash (make-symbol "a")) (sxhash (make-symbol "a")))

This form always evaluates to nil:

  (equal (make-symbol "a") (make-symbol "a"))

The hash of a symbol is the hash of its namel; that seems silly, since
symbol equality is based on identity. We should be able to just use the
symbol address instead, right?


=== modified file 'src/fns.c'
--- src/fns.c   2014-09-15 05:09:44 +0000
+++ src/fns.c   2014-09-16 00:14:52 +0000
@@ -4482,13 +4482,10 @@
       break;

     case Lisp_Misc:
+    case Lisp_Symbol:
       hash = XHASH (obj);
       break;

-    case Lisp_Symbol:
-      obj = SYMBOL_NAME (obj);
-      /* Fall through.  */
-
     case Lisp_String:
       hash = sxhash_string (SSDATA (obj), SBYTES (obj));
       break;


Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]