unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@IRO.UMontreal.CA>
To: Michael Heerdegen <michael_heerdegen@web.de>
Cc: Mark Oteiza <mvoteiza@udel.edu>,
	npostavs@users.sourceforge.net, emacs-devel@gnu.org
Subject: Re: if-let/if-let*/and-let/..
Date: Thu, 22 Feb 2018 00:10:22 -0500	[thread overview]
Message-ID: <jwv371ty5vg.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87sh9t4yrj.fsf@web.de> (Michael Heerdegen's message of "Thu, 22 Feb 2018 02:08:16 +0100")

> Mark had implemented and-let* as in srfi-2:
>   https://srfi.schemers.org/srfi-2/srfi-2.html
> (scroll to "Specification")
> which interprets a (bound) symbol in the binding spec as a boolean.

OK, that makes sense.

> That treatment of a single SYMBOL in the SPEC is redundant AFAIK (in the
> SRFI2 and in master) since it can also be written as (SYMBOL).

The (SYMBOL) syntax is not very attractive, tho (to me, it really gives
me the impression that I'm binding SYMBOL to nil).  As a programmer, I'd
much rather write SYMBOL for that and if that's not an option, then
I'd use (_ SYMBOL) to make it clear that SYMBOL is just evaluated and
not bound.

> (pcase spec
>     (`(,(pred symbolp) . ,rest)
>      (pcase rest
>        (`(,_) (cl-callf list spec)) ;the single binding syntax
>        (_     (signal 'error (list "if-let: Bad binding spec" spec))))))

So you'd then support the SYMBOL syntax as a shorthand for (_ SYMBOL)
*except* as the first element of the spec?
That would be OK for me (tho the above error message might like to
suggest the use of (_ SYMBOL) to circumvent this restriction).


        Stefan



  reply	other threads:[~2018-02-22  5:10 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-11 23:51 if-let/if-let*/and-let/ Stefan Monnier
     [not found] ` <87wozijhpk.fsf@web.de>
     [not found]   ` <jwv8tbyyx4x.fsf-monnier+emacs@gnu.org>
2018-02-12 17:32     ` if-let/if-let*/and-let/ Stefan Monnier
2018-02-13 18:23       ` if-let/if-let*/and-let/ Michael Heerdegen
2018-02-13 19:24         ` if-let/if-let*/and-let/ Stefan Monnier
2018-02-13 20:52           ` if-let/if-let*/and-let/ John Wiegley
2018-02-13 19:31         ` if-let/if-let*/and-let/ Mark Oteiza
2018-02-13 20:49           ` if-let/if-let*/and-let/ Stefan Monnier
2018-02-14  0:07             ` if-let/if-let*/and-let/ Mark Oteiza
2018-02-14 23:07               ` if-let/if-let*/and-let/ Michael Heerdegen
2018-02-15  3:37                 ` if-let/if-let*/and-let/ Stefan Monnier
2018-02-21  4:26                   ` if-let/if-let*/and-let/ Michael Heerdegen
2018-02-22  1:08                   ` if-let/if-let*/and-let/ Michael Heerdegen
2018-02-22  5:10                     ` Stefan Monnier [this message]
2018-02-22  7:55                       ` if-let/if-let*/and-let/ Michael Heerdegen
2018-03-03 14:12                         ` if-let/if-let*/and-let/ Michael Heerdegen
2018-03-06 15:03                           ` if-let/if-let*/and-let/ Michael Heerdegen
2018-03-06 15:31                             ` if-let/if-let*/and-let/ Michael Heerdegen
2018-03-06 15:34                               ` if-let/if-let*/and-let/ John Wiegley
2018-03-06 16:03                                 ` if-let/if-let*/and-let/ Stefan Monnier
2018-03-06 17:40                                   ` if-let/if-let*/and-let/ Michael Heerdegen
2018-03-06 19:12                                     ` if-let/if-let*/and-let/ Radon Rosborough
2018-03-07  2:13                                       ` if-let/if-let*/and-let/ James Nguyen
2018-03-07  3:42                                         ` if-let/if-let*/and-let/ Kaushal Modi
2018-03-06 17:40                                   ` if-let/if-let*/and-let/ Eli Zaretskii
2018-03-07 14:15                                     ` if-let/if-let*/and-let/ Michael Heerdegen
2018-03-07 15:13                                       ` if-let/if-let*/and-let/ Nicolas Petton
2018-03-07 20:43                                       ` if-let/if-let*/and-let/ John Wiegley
2018-03-08 13:53                                       ` if-let/if-let*/and-let/ Eli Zaretskii
2018-03-09 15:16                                         ` if-let/if-let*/and-let/ Michael Heerdegen
2018-03-09 15:32                                           ` if-let/if-let*/and-let/ Eli Zaretskii
2018-03-09 16:07                                             ` if-let/if-let*/and-let/ Michael Heerdegen
2018-03-09 16:24                                               ` if-let/if-let*/and-let/ Eli Zaretskii
2018-03-09 16:33                                                 ` if-let/if-let*/and-let/ Michael Heerdegen
2018-03-09 18:22                                                   ` if-let/if-let*/and-let/ Eli Zaretskii
2018-03-09 22:24                                                     ` if-let/if-let*/and-let/ Michael Heerdegen
2018-03-10  8:02                                                       ` if-let/if-let*/and-let/ Eli Zaretskii
2018-03-10 15:54                                                         ` if-let/if-let*/and-let/ Stefan Monnier
2018-03-10 16:07                                                         ` if-let/if-let*/and-let/ Michael Heerdegen
2018-03-10 16:29                                                           ` if-let/if-let*/and-let/ Eli Zaretskii
2018-03-10 17:16                                                             ` if-let/if-let*/and-let/ Michael Heerdegen
2018-03-10 17:29                                                               ` if-let/if-let*/and-let/ Eli Zaretskii
2018-03-06 16:04                                 ` if-let/if-let*/and-let/ Eli Zaretskii
2018-03-06 17:35                                   ` if-let/if-let*/and-let/ Michael Heerdegen
2018-02-13 20:54           ` if-let/if-let*/and-let/ Michael Heerdegen
2018-02-13 21:57             ` if-let/if-let*/and-let/ Eric Abrahamsen
2018-02-13 22:39               ` if-let/if-let*/and-let/ Michael Heerdegen
2018-02-13 22:51                 ` if-let/if-let*/and-let/ Eric Abrahamsen

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=jwv371ty5vg.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    --cc=michael_heerdegen@web.de \
    --cc=mvoteiza@udel.edu \
    --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).