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: [Emacs-diffs] master 9dd95bf: * lisp/emacs-lisp/pcase.el (pcase--u1): Fix bignums Date: Fri, 26 Oct 2018 15:37:20 -0400 Message-ID: References: <83bm7hozav.fsf@gnu.org> <83zhv0oink.fsf@gnu.org> <83va5ooboc.fsf@gnu.org> <83pnvwo7i3.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1540582541 11299 195.159.176.226 (26 Oct 2018 19:35:41 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 26 Oct 2018 19:35: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 Oct 26 21:35: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 1gG7tQ-0002pE-L8 for ged-emacs-devel@m.gmane.org; Fri, 26 Oct 2018 21:35:36 +0200 Original-Received: from localhost ([::1]:33941 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gG7vX-0007qG-84 for ged-emacs-devel@m.gmane.org; Fri, 26 Oct 2018 15:37:47 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34268) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gG7vN-0007eL-RE for emacs-devel@gnu.org; Fri, 26 Oct 2018 15:37:41 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gG7vG-00057o-8G for emacs-devel@gnu.org; Fri, 26 Oct 2018 15:37:37 -0400 Original-Received: from [195.159.176.226] (port=60787 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gG7vE-00055K-9a for emacs-devel@gnu.org; Fri, 26 Oct 2018 15:37:28 -0400 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1gG7t5-0002O1-Ia for emacs-devel@gnu.org; Fri, 26 Oct 2018 21:35:15 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 46 Original-X-Complaints-To: usenet@blaine.gmane.org Cancel-Lock: sha1:9hHA9oYP9ba1RQOPKKpRtQcvsSU= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] 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:230724 Archived-At: >> >> Would you feel the same if `pcase` always used `equal` and the >> >> optimization to `eql` were performed in the byte-compiler instead? >> > I don't know, and it's not really relevant, is it? >> It is: the use of `eq` or `eql` here is an optimization which pcase >> performs only because the compiler doesn't do it. > I disagree. We describe our code, not what the compiler produces out > of it. Here I disagree: the pcase doc does not describe the generated code, it only describes the resulting behavior. >> > ‘KEYWORD’ >> > ‘INTEGER’ >> > ‘STRING’ >> > Matches if EXPVAL is equal to the literal object. The equality >> > predicate depends on the type of the object; e.g., symbols are >> > compared using 'eq', and strings using 'equal'. >> >> I think we should say here that the semantics is that of `equal` and not >> that of `eq` (or `=` or whatever else). >> >> The above would allow `pcase` to use `eq` for integers. > > Where does it say something that has that effect? `eq` is a notion of equality, so "is equal to the literal object" is a valid description even if we use `eq`. Futhermore the subsequent text makes it clear that `pcase` would be free to use whichever notion of equality it deems appropriate since "The equality predicate depends on the type of the object". >> IOW if pcase uses `eq` on integers (as it did until yesterday) and >> some code uses pcase to match a bignum, the above would let us say >> that the bug is in the pcase use rather than in the pcase >> implementation. >> >> Compared to the current doc, it also leaves it unclear whether 1.0 would >> match the '1 pattern. > > So you now agree to describe in detail what predicate is used for each > data type? Yes, that's what I've done: `equal` is the predicate used. ;-) Stefan