From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= Newsgroups: gmane.emacs.devel Subject: Re: Bug#38708: eq vs eql in byte-compiled code Date: Thu, 2 Jan 2020 18:26:29 +0100 Message-ID: <613F0F55-EE3E-4A19-9A02-A0CC34172B13@acm.org> References: <8cd1b5b2-b94e-ce64-0d70-c1b8b012d685@cs.ucla.edu> <22304b46-55df-578d-7ce5-97c8b60f684e@cs.ucla.edu> Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="230705"; mail-complaints-to="usenet@blaine.gmane.org" Cc: Pip Cet , Emacs developers To: Paul Eggert Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jan 02 18:27:26 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1in4Fp-000xsk-5E for ged-emacs-devel@m.gmane.org; Thu, 02 Jan 2020 18:27:25 +0100 Original-Received: from localhost ([::1]:43402 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1in4Fo-0004JA-1S for ged-emacs-devel@m.gmane.org; Thu, 02 Jan 2020 12:27:24 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35981) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1in4FE-0003kK-Tl for emacs-devel@gnu.org; Thu, 02 Jan 2020 12:26:50 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1in4FD-0005GK-LD for emacs-devel@gnu.org; Thu, 02 Jan 2020 12:26:48 -0500 Original-Received: from mail205c50.megamailservers.eu ([91.136.10.215]:43530 helo=mail193c50.megamailservers.eu) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1in4FD-0005E4-1f for emacs-devel@gnu.org; Thu, 02 Jan 2020 12:26:47 -0500 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1577985992; bh=JV6BWJZYDx2uYx+RqQAoRxoM3FHFn+QuBH9LS34TPMo=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=GZ9qm9PgEVLz33Tvt3HWxE0zgma7/T7w71K/in2BNsNhGvDXDqkj+m+aXQe0zdSei RXK2pk/0k6Z2ByVt5b5z+xOOGrBTg2miNbWNAj6SJLkPtDFCwPAr4dyNoja4VdH20N 2gJrTDBamlYftxcW1o34H5GfP/n1LdJdphWhiNUs= Feedback-ID: mattiase@acm.or Original-Received: from [192.168.0.4] (c188-150-171-71.bredband.comhem.se [188.150.171.71]) (authenticated bits=0) by mail193c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 002HQUf5021300; Thu, 2 Jan 2020 17:26:32 +0000 In-Reply-To: <22304b46-55df-578d-7ce5-97c8b60f684e@cs.ucla.edu> X-Mailer: Apple Mail (2.3445.104.11) X-CTCH-RefID: str=0001.0A0B020C.5E0E27C8.0034, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: 0.000 X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.3 cv=SamJicZu c=1 sm=1 tr=0 a=SF+I6pRkHZhrawxbOkkvaA==:117 a=SF+I6pRkHZhrawxbOkkvaA==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=kj9zAlcOel0A:10 a=M51BFTxLslgA:10 a=UlWFv2l7jsdvzosh35EA:9 a=CjuIK1q_8ugA:10 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] [fuzzy] X-Received-From: 91.136.10.215 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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:243871 Archived-At: 2 jan. 2020 kl. 09.38 skrev Paul Eggert : > [...] If it's not > important, then I'd say the flonum/bignum deduplication patch is not = urgent > enough to put into Emacs 27. Yes, we'd better leave Emacs 27 alone, except for improved = documentation. I'm feeling queasy about hash-consing floats and bignums. Benchmarking = is treacherous in several regards: there is currently very little use of = bignums for obvious reasons, and Emacs sessions are famously long-lived. = The real problem is Emacs's archaic non-generational GC. Most bignums aren't very big; they tend to obey a power law. = Particularly common are full-word integers, just a bit or two larger = than fixnums. They crop up in various kind of system interfaces (IDs, = handles, addresses etc), FFIs, checksums/hashes, fields in binary files = and protocols, and so on. Having bignums, we may see quite a few of = these. In other words, making bignums/flonums slower may seem to have no bad = effects, until suddenly it has. > The manual already says this: >=20 > To test numbers for numerical equality, you should normally use > @code{=3D} instead of non-numeric comparison predicates like = @code{eq}, > @code{eql} and @code{equal}. That sentence mentions eq and eql as equally inferior alternatives to =3D,= which isn't necessarily helpful. > I found that a bit too dogmatic about avoiding eq on numbers, as it's = reasonable > to use eq in many cases (I do it in my code, you do it in your code, = and as long > as you know what you're doing it's OK). We should be allowed to make recommendations as long as it's made clear = that experts (ahem) can do what they please, no? The user may otherwise = not realise that using eql instead of eq (1) makes their code more = portable, and (2) extends it to a greater range of input data, both of = which will make it useful in a wider range of circumstances. That said, your patch is fine! One sentence, though: > +If they were computed separately but happen to have the same value > +and the same non-fixnum numeric type, then they might or might not be > the same object, and @code{eq} returns @code{t} or @code{nil} > depending on whether the Lisp interpreter created one object or two. The "computed separately" qualifier is a bit too vague, but the = statement also risks becoming too strong. Can't we just say that equal = non-fixnum numbers may or may not be eq?