From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Noam Postavsky Newsgroups: gmane.emacs.bugs Subject: bug#31311: 27.0; doc of `pcase' Date: Sat, 12 May 2018 09:56:21 -0400 Message-ID: <877eo9kmey.fsf@gmail.com> References: <83wowqrmp8.fsf@gnu.org> <87efixlv8g.fsf@web.de> <83muxlsvfm.fsf@gnu.org> <871sexlqvw.fsf@web.de> <83k1sps9n3.fsf@gnu.org> <87wowpndoo.fsf@gmail.com> <87fu3c6cm3.fsf@gnuvola.org> <83zi1kqynx.fsf@gnu.org> <871seh3yw8.fsf@gnuvola.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1526133310 22313 195.159.176.226 (12 May 2018 13:55:10 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 12 May 2018 13:55:10 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) To: 31311@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat May 12 15:55:06 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1fHUzI-0005YM-7i for geb-bug-gnu-emacs@m.gmane.org; Sat, 12 May 2018 15:55:04 +0200 Original-Received: from localhost ([::1]:47162 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fHV1N-000476-MX for geb-bug-gnu-emacs@m.gmane.org; Sat, 12 May 2018 09:57:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43260) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fHV1G-00046f-Sp for bug-gnu-emacs@gnu.org; Sat, 12 May 2018 09:57:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fHV1C-0006az-1K for bug-gnu-emacs@gnu.org; Sat, 12 May 2018 09:57:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:51792) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fHV1B-0006ak-SY for bug-gnu-emacs@gnu.org; Sat, 12 May 2018 09:57:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fHV1B-0006z1-K8 for bug-gnu-emacs@gnu.org; Sat, 12 May 2018 09:57:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Noam Postavsky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 12 May 2018 13:57:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 31311 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 31311-submit@debbugs.gnu.org id=B31311.152613339126803 (code B ref 31311); Sat, 12 May 2018 13:57:01 +0000 Original-Received: (at 31311) by debbugs.gnu.org; 12 May 2018 13:56:31 +0000 Original-Received: from localhost ([127.0.0.1]:59689 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fHV0g-0006yF-SB for submit@debbugs.gnu.org; Sat, 12 May 2018 09:56:31 -0400 Original-Received: from mail-it0-f54.google.com ([209.85.214.54]:54376) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fHV0e-0006y1-UY for 31311@debbugs.gnu.org; Sat, 12 May 2018 09:56:29 -0400 Original-Received: by mail-it0-f54.google.com with SMTP id z6-v6so5237408iti.4 for <31311@debbugs.gnu.org>; Sat, 12 May 2018 06:56:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:references:date:in-reply-to:message-id:user-agent :mime-version:content-transfer-encoding; bh=plITm4BnsDbDKZE1myzraVfo7FJzoahk3/yDGPkDizw=; b=jh7r0omurcTgMpxVm3cHYOg2YI9wGgwhbxOZgxJ1374ockATHApp+23o8Yep4iLAvy 33WTxCp5l8ENVBDtrM/mT2dAXbIistnQ+Eng9SwCNdzdODypD92JjXPqv8RH9kxiCPL+ V7tlM6PWzKtbpU4FOjcjzmWRJHPICwRRQDZJfrIjTpKYak/10+Kn87PCszmAGvmUDsxv 7It323aOJX0nbgEA0JNBqNYxwwdTr+6Pb+NHElEUYnfcLFYDlG8uMx5DCGyNsAd3BPid Te9sqdkmQt3ctbfdS/BxEcs25xkdUSrPqTPqikGKNYokIul87UN66IWBCjMqjqJrTBow CDvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=plITm4BnsDbDKZE1myzraVfo7FJzoahk3/yDGPkDizw=; b=sTGHQegYry5rGYTOAW0YW4jC8f9XM4X20qeEyoQ1dulaK7rzxUbJ5E3lBlqRHihcko 2ymQot+tqPJxL4pJnF5bdPX5/TVVxMEzuigMa8Jw1nNJvL5pCHM+nvvhJeQvFQCWZ1iP 2/swHGRCnkCBUGB1vkSEAnE1kinaLDzrENyruknktCnlr+KVkd5R0/EvEuGq2PbMNYGx 5WEFqaJe+gmxPrbNxw95uk5EVF+JGARJRfqrmtgqJkZtzVq9AyHrDweuNgE+sscLmx2X gP4/qoABhX9hyNkwsBW5421Hg39cGn9c1ll8BSv3RV3rwjET8gEIoRKmxzIDVja9M70C H9KA== X-Gm-Message-State: ALKqPwc0oXQGi9Vv5kpHpnPZeLq4ZW4Rk5a6WNIr3USWax4l95Y63IlW Wpv1rN6Y5SkSfVkSQ0awN/+dbg== X-Google-Smtp-Source: AB8JxZrV28Qj5PzPPrEYHRFZn4tjrupjI2MnIIIV4YG1q3WOQhMb10amKHx+04yFv7jYAm24y8sVDQ== X-Received: by 2002:a24:19c9:: with SMTP id b192-v6mr2373088itb.78.1526133383000; Sat, 12 May 2018 06:56:23 -0700 (PDT) Original-Received: from zebian (cbl-45-2-119-34.yyz.frontiernetworks.ca. [45.2.119.34]) by smtp.googlemail.com with ESMTPSA id m89-v6sm2646788iod.1.2018.05.12.06.56.22 for <31311@debbugs.gnu.org> (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 12 May 2018 06:56:22 -0700 (PDT) In-Reply-To: <871seh3yw8.fsf@gnuvola.org> (Thien-Thi Nguyen's message of "Sat, 12 May 2018 13:18:47 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:146137 Archived-At: Thien-Thi Nguyen writes: > * c6e9b975f add some Issue comments; nfc > > This first set of ponderables revolves around the precise > semantics of the SYMBOL let-binding feature. > +@c - This is a design decision. Document the limitation > +@c (i.e., BOOLEAN-EXPRESSION SHOULD NOT be side-effecting). > +@c - This is an unforseen case; behavior is based on the > +@c implementation (=E2=80=98cond=E2=80=99 + redundant =E2=80=98= let*=E2=80=99 expansion) > +@c and is considered {undefined, wontfix, futurefix}. > +@c Leave undocumented for now. I would say the behaviour of pcase when guard expressions have side-effects is not defined, so the documentation should advise against having side-effects in guard expressions. By the way, the current implementation causes a compiler warning if the variable is not used in the body (Bug#16771), so it may well be changed if someone can figure out how. > Additionally, related to SYMBOL binding, i see (in *scratch*): > > a. (pcase t ('t 'true)) =3D> true > b. (pcase nil ('nil 'false)) =3D> false > c. (pcase t (t 'true)) =3D> true Yes, it looks like t is intentionally equivalent to _, cf pcase.el: (defconst pcase--dontcare-upats '(t _ pcase--dontcare)) Hence also: (pcase 42 (t 'true)) =3D> true > d. (pcase nil (nil 'false)) |=3D ERROR: Unknown pattern =E2=80=98nil= =E2=80=99 In Emacs 24.5, it gives "Lisp error: (setting-constant nil)", so we can see that this case now gives a more specific error. > For anyone just joining, these commits are on the branch > =E2=80=98fix/bug-31311-pcase-doc=E2=80=99 (off of =E2=80=98emacs-26=E2=80= =99). Feedback on > anything there is most welcome! In the docstring, you have The two catagories of patterns are logical and structural. A logical pattern expands, in essence, to a predicate function to call on EXPVAL. [...] On the other hand, a structural pattern specifies a template, and allows for elements of that template to be either constants or sub-patterns (of either category). You grouped SYMBOL into the "logical patterns", but I don't think it really fits into either of those. Better to make it separate, perhaps? I'm also not so sure it's a useful division. At least, they shouldn't be presented as equal categories. The "structural" is more a short form for particular kinds of "logical" patterns. For example, `(1 . 2) is equivalent to (and (pred consp) (app car 1) (app cdr 2))