From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Drew Adams 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 18:50:06 -0800 (PST) Message-ID: <12e87d5c-9d47-4bb5-ac6f-bf2b87817f13@default> References: <20180215203406.64372-1-phst@google.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1518749348 9488 195.159.176.226 (16 Feb 2018 02:49:08 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 16 Feb 2018 02:49:08 +0000 (UTC) To: Stefan Monnier , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Feb 16 03:49:04 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 1emW4x-0001M1-QW for ged-emacs-devel@m.gmane.org; Fri, 16 Feb 2018 03:48:51 +0100 Original-Received: from localhost ([::1]:58812 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1emW6y-0004xu-BT for ged-emacs-devel@m.gmane.org; Thu, 15 Feb 2018 21:50:56 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35422) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1emW6K-0004uz-Eo for emacs-devel@gnu.org; Thu, 15 Feb 2018 21:50:17 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1emW6H-0004Wz-D3 for emacs-devel@gnu.org; Thu, 15 Feb 2018 21:50:16 -0500 Original-Received: from userp2120.oracle.com ([156.151.31.85]:53588) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1emW6H-0004Wd-2p for emacs-devel@gnu.org; Thu, 15 Feb 2018 21:50:13 -0500 Original-Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w1G2lU7W176615; Fri, 16 Feb 2018 02:50:11 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=mime-version : message-id : date : from : sender : to : subject : references : in-reply-to : content-type : content-transfer-encoding; s=corp-2017-10-26; bh=vUWhnA+nmSk57rzwiAb0iRFMy18GxoniPdT49NZZBBw=; b=G7Rkp4+J/pdE0WlenxPFGXz14RHJ7oiUBe7BR3QJAUATxHQndR2BQuoxggK94gy1Je4D WmuUAOuy2uRBcuukBSbgRBzteTSkOio0qRJsl3rB1SaUp7LzLdGz7Bi8VmV2EePL0TiQ leb5VH7JWQlOH6J5Z02wEXPZ+B/vmOZ+I1n8yo8lLwDXM/CyqaRYhbiyA2lkv5OhsLtW JJy2omecnTyNMBXHnQMKvi/W0YKwSra8OLN+m9TZg2I0X84pIFA/yZ00MSMwoHlbfkyJ uuRSrt7thC4emNd1UQ4KjrBcrK+xtYQmwznUg1V3V1YY2taTnxaOd3CfOvL5ltwX1Xoq MA== Original-Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp2120.oracle.com with ESMTP id 2g5pdy032p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 16 Feb 2018 02:50:11 +0000 Original-Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w1G2oAeb009861 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 16 Feb 2018 02:50:10 GMT Original-Received: from abhmp0005.oracle.com (abhmp0005.oracle.com [141.146.116.11]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w1G2o7l7015106; Fri, 16 Feb 2018 02:50:07 GMT In-Reply-To: X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 16.0.4654.0 (x86)] X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8806 signatures=668672 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=859 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1802160029 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 156.151.31.85 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:222802 Archived-At: > > But isn't it better to define this in C? >=20 > To me the answer is usually no, unless it's speed-critical. To me too, the answer is usually no. If this is done in Lisp it is presumably because it might be useful to someone to modify or advise, or at least serve as food for thought. In that case, the code should be as clear as possible. > 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). Definitely more interesting. > But that would imply > a fairly significant amount of design to make it work.