From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] Add new function to test whether a key is present in a hash table. Date: Thu, 15 Feb 2018 20:59:12 -0500 Message-ID: References: <20180215203406.64372-1-phst@google.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1518746441 15760 195.159.176.226 (16 Feb 2018 02:00:41 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 16 Feb 2018 02:00:41 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Feb 16 03:00:37 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1emVK6-00038u-AL for ged-emacs-devel@m.gmane.org; Fri, 16 Feb 2018 03:00:26 +0100 Original-Received: from localhost ([::1]:54971 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1emVM8-0004A5-0I for ged-emacs-devel@m.gmane.org; Thu, 15 Feb 2018 21:02:32 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56015) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1emVLt-00047g-Jv for emacs-devel@gnu.org; Thu, 15 Feb 2018 21:02:18 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1emVLq-0004fC-In for emacs-devel@gnu.org; Thu, 15 Feb 2018 21:02:17 -0500 Original-Received: from [195.159.176.226] (port=39801 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1emVLq-0004f0-B8 for emacs-devel@gnu.org; Thu, 15 Feb 2018 21:02:14 -0500 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1emVJk-0001xU-Pk for emacs-devel@gnu.org; Fri, 16 Feb 2018 03:00:04 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 14 Original-X-Complaints-To: usenet@blaine.gmane.org Cancel-Lock: sha1:jA+im8Yz+8IT/5iZj3NJ9qDyg3g= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 195.159.176.226 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:222797 Archived-At: > But isn't it better to define this in C? To me the answer is usually no, unless it's speed-critical. Stefan PS: I think a more interesting function to provide would be some gethash-ref which would return some kind of "reference" to the entry, so we can afterwards update that hash-table entry without (re)computing the hash (i.e. some kind of equivalent to `intern` after which you can just do `set` which doesn't involve hashing any more). But that would imply a fairly significant amount of design to make it work.