GNU bug report logs - #28254
26.0.50; SRFI-2 and-let*

Previous Next

Package: emacs;

Reported by: Mark Oteiza <mvoteiza <at> udel.edu>

Date: Sun, 27 Aug 2017 20:12:02 UTC

Severity: wishlist

Found in version 26.0.50

Done: Mark Oteiza <mvoteiza <at> udel.edu>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: Mark Oteiza <mvoteiza <at> udel.edu>
Cc: 28254 <at> debbugs.gnu.org, Noam Postavsky <npostavs <at> users.sourceforge.net>
Subject: bug#28254: 26.0.50; SRFI-2 and-let*
Date: Tue, 12 Sep 2017 20:44:11 +0200
Mark Oteiza <mvoteiza <at> udel.edu> writes:

> > Not really related to your change, but: Maybe we should additionally
> > say that THEN can refer to the bindings made in the VARLIST, but
> > ELSE to none, not even to those that resulted in non-nil values
> > before "failing".
>
> That's not true though--you can refer to the bindings in either branch:

Hmm, that feels strange.  FWIW, all the scheme implementations I looked
at implemented it in a way that binding variables stops after the first
nil.  OTOH I would expect that all bindings are only available from the
THIS branch (this is my personal opinion).  In our case, we have
something third: always all bindings are visible in the ELSEs, e.g.

(let ((z 1))
  (if-let* ((nil) (z 100))
      (doesnt-matter)
    z))

==> nil

That doesn't feel right.


I have two more questions:

In `internal--listify':

(defsubst internal--listify (elt)
  "Wrap ELT in a list if it is not one.
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))))
    (list (make-symbol "s") (car elt)))
   (t elt)))

isn't (or (listp form) (atom form)) always true?


Secondly, in `internal--build-binding-value-form':

(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))))))

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?


Thanks,

Michael.




This bug report was last modified 7 years and 253 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.