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: pcase: Semantics of atom QPATS Date: Mon, 11 Jun 2018 10:09:37 -0400 Message-ID: References: <87tvqbjwyf.fsf@web.de> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1528726139 12715 195.159.176.226 (11 Jun 2018 14:08:59 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 11 Jun 2018 14:08:59 +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 Mon Jun 11 16:08:55 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 1fSNV8-0003Eq-UB for ged-emacs-devel@m.gmane.org; Mon, 11 Jun 2018 16:08:55 +0200 Original-Received: from localhost ([::1]:49057 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fSNXF-0005oe-Lc for ged-emacs-devel@m.gmane.org; Mon, 11 Jun 2018 10:11:05 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48588) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fSNW8-0005fz-Dc for emacs-devel@gnu.org; Mon, 11 Jun 2018 10:09:57 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fSNW4-0003If-Df for emacs-devel@gnu.org; Mon, 11 Jun 2018 10:09:56 -0400 Original-Received: from [195.159.176.226] (port=51842 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fSNW4-0003HV-6b for emacs-devel@gnu.org; Mon, 11 Jun 2018 10:09:52 -0400 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1fSNTu-0001wj-KB for emacs-devel@gnu.org; Mon, 11 Jun 2018 16:07:38 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 33 Original-X-Complaints-To: usenet@blaine.gmane.org Cancel-Lock: sha1:E25i/xDQfb05KQU1vF7apBXYmLk= 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:226209 Archived-At: > isn't it strange that the pattern '.7 matches .7, but `.7 causes an > error when used? Yes and no: the pattern ' is defined to match using (equal x '), no matter what. In contrast, ` behaves differently depending on the type of the backquoted object and it only supports a limited set of types (those documented in its docstring). So it's normal for the two to behave differently. > IMO the analogy to the list of self-quoting atoms (strings, keywords, > integers - I'm all for that) is misguided here - something implicitly > quoted in a backquoted pattern (i.e. something that is not unquoted) > should behave like quoted with `'' (i.e. transformed into an `eq' test), > everything else feels inconsistent. [ It's an `equal` test we want, not `eq`. ] The issue is rather that not all types might want an `equal` test. E.g. we could accept patterns like `#s(hash-table (data ,key1 ,val1)) Which is why I prefer signaling an error: it lets us extend the semantics of ` without any fear of breaking backward compatibility. But yes: it makes sense to extend pcase's ` pattern to accept floats and match them with `equal` since it's easy and there doesn't seem to be many other semantics to choose anyway. Stefan