unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Mark Oteiza <mvoteiza@udel.edu>
To: Michael Heerdegen <michael_heerdegen@web.de>
Cc: 28254@debbugs.gnu.org, Noam Postavsky <npostavs@users.sourceforge.net>
Subject: bug#28254: 26.0.50; SRFI-2 and-let*
Date: Wed, 13 Sep 2017 07:48:46 -0400	[thread overview]
Message-ID: <20170913114846.GA25686@holos.localdomain> (raw)
In-Reply-To: <8760cm299r.fsf@drachen>

On 13/09/17 at 12:16pm, Michael Heerdegen wrote:
> Mark Oteiza <mvoteiza@udel.edu> writes:
> 
> > > In `internal--listify':
> > > isn't (or (listp form) (atom form)) always true?
> >
> > Yes, that could instead be (or form (null form)). It's meant to catch
> > things like this:
> >
> >   (should (equal nil (and-let* ((nil) (x 1)))))
> 
> Why can't we just replace it with the equivalent `t' (and simplify the
> code accordingly)?

Oh goodness… thanks.

> > > Secondly, in `internal--build-binding-value-form':
> > > How can it happen that (car binding) is an atom but not symbolp?  And if
> > > (car binding) == var is not a symbol, how does the returned binding make
> > > sense?
> >
> > It's an expression, like a number.
> >
> >   (should (equal 1 (and-let* ((2) (x 1)))))
> 
> AFAICT, this doesn't run the code I mention.  If I trace
> `internal--build-binding-value-form' and try this, I get
> 
> 1 -> (internal--build-binding-value-form (#:s nil) t)
> 1 <- internal--build-binding-value-form: (#:s (and t nil))
> ======================================================================
> 1 -> (internal--build-binding-value-form (x 1) #:s)
> 1 <- internal--build-binding-value-form: (x (and #:s 1))
> 
> In both cases, (car binding) evals to a symbol.

I guess the following is fine then--thanks for finding these.

diff --git a/lisp/emacs-lisp/subr-x.el b/lisp/emacs-lisp/subr-x.el
index 3ea01065c8..ba0ab6cb4c 100644
--- a/lisp/emacs-lisp/subr-x.el
+++ b/lisp/emacs-lisp/subr-x.el
@@ -87,9 +87,7 @@ internal--listify
 If ELT is of the form ((EXPR)), listify (EXPR) with a dummy symbol."
   (cond
    ((symbolp elt) (list elt elt))
-   ((and (null (cdr elt))
-         (let ((form (car elt)))
-           (or (listp form) (atom form))))
+   ((null (cdr elt))
     (list (make-symbol "s") (car elt)))
    (t elt)))
 
@@ -104,9 +102,7 @@ internal--check-binding
 (defsubst internal--build-binding-value-form (binding prev-var)
   "Build the conditional value form for BINDING using PREV-VAR."
   (let ((var (car binding)))
-    (if (and (null (cdr binding)) (atom (car binding)) (not (symbolp (car binding))))
-        `(,var (and ,prev-var ,var))
-      `(,var (and ,prev-var ,(cadr binding))))))
+    `(,var (and ,prev-var ,(cadr binding)))))
 
 (defun internal--build-binding (binding prev-var)
   "Check and build a single BINDING with PREV-VAR."





  reply	other threads:[~2017-09-13 11:48 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-27 20:11 bug#28254: 26.0.50; SRFI-2 and-let* Mark Oteiza
2017-09-01  2:55 ` npostavs
2017-09-02  2:10   ` Mark Oteiza
2017-09-02  3:05     ` npostavs
2017-09-02  4:14       ` Mark Oteiza
2017-09-02  5:25         ` Michael Heerdegen
2017-09-02 13:36           ` Mark Oteiza
2017-09-02 18:41             ` Noam Postavsky
2017-09-03 17:48               ` Michael Heerdegen
2017-09-03 22:39                 ` Mark Oteiza
2017-09-04  0:48                   ` Mark Oteiza
2017-09-04 14:12                   ` Michael Heerdegen
2017-09-05  3:47                   ` Mark Oteiza
2017-09-05 15:04                     ` Michael Heerdegen
2017-09-06 12:12                     ` Michael Heerdegen
2017-09-06 13:06                       ` Mark Oteiza
2017-09-06 19:04                         ` Michael Heerdegen
2017-09-04  1:13               ` Mark Oteiza
2017-09-05  3:55                 ` Mark Oteiza
2017-09-09  0:33                   ` Mark Oteiza
2017-09-12 12:39                     ` Michael Heerdegen
2017-09-12 13:09                       ` Mark Oteiza
2017-09-12 18:44                         ` Michael Heerdegen
2017-09-12 20:21                           ` Mark Oteiza
2017-09-13 10:16                             ` Michael Heerdegen
2017-09-13 11:48                               ` Mark Oteiza [this message]
2017-09-13 16:46                                 ` Michael Heerdegen
2017-09-13 16:49                                   ` Mark Oteiza
2017-09-13 17:05                                     ` Michael Heerdegen
2017-09-13 17:28                                       ` Mark Oteiza
2017-09-13 17:49                                         ` Michael Heerdegen
2017-09-12 12:13                   ` Michael Heerdegen
2017-09-12 14:29                     ` Mark Oteiza

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170913114846.GA25686@holos.localdomain \
    --to=mvoteiza@udel.edu \
    --cc=28254@debbugs.gnu.org \
    --cc=michael_heerdegen@web.de \
    --cc=npostavs@users.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).