unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Mattias Engdegård" <mattiase@acm.org>
To: Michael Heerdegen <michael_heerdegen@web.de>
Cc: 50136@debbugs.gnu.org, monnier@iro.umontreal.ca
Subject: bug#50136: 28.0.50; A problem with rx-let expansion
Date: Fri, 20 Aug 2021 20:45:41 +0200	[thread overview]
Message-ID: <B4B50ED2-0692-48DF-82A4-977D44C6C3B0@acm.org> (raw)
In-Reply-To: <87y28whw1b.fsf@web.de>

20 aug. 2021 kl. 19.21 skrev Michael Heerdegen <michael_heerdegen@web.de>:

> I guess it's not very useful for the current mechanism.  With a
> macro-like thing, the expansion would just not use the value if it's nil.  The
> expander would check whether the argument was provided.

Yes. It was (and is) a trade-off between the simpler "template-like" semantics currently used and the programmatic "execute code" semantics of Lisp macros. The idea was that the simpler semantics would be simpler and sufficient for most uses, and `eval` forms could always be employed in other cases.

I'm still fretting over having made the wrong call, and that at least I should have omitted parametrised rx definitions until better understood.

If you just have one optional argument, try &rest -- at least its default-case semantics are crystal clear (no arguments inserted). Obviously, you could also use separate rx macros for different parameter lists:

(rx-let ((delimited (grp delim) (seq delim (group-n grp (* (not delim)) delim)))
         (double-quoted (grp) (delimited grp ?\")))

etc.






  reply	other threads:[~2021-08-20 18:45 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-20 13:59 bug#50136: 28.0.50; A problem with rx-let expansion Michael Heerdegen
2021-08-20 14:50 ` Michael Heerdegen
2021-08-20 15:23 ` Mattias Engdegård
2021-08-20 17:21   ` Michael Heerdegen
2021-08-20 18:45     ` Mattias Engdegård [this message]
2021-08-21 11:45       ` Michael Heerdegen
2021-08-21 13:02         ` Mattias Engdegård
2021-08-23 10:45           ` Michael Heerdegen
2021-08-23 12:38             ` Mattias Engdegård
2021-08-23 15:20             ` Mattias Engdegård
2021-08-23 16:59               ` Michael Heerdegen
2021-08-23 18:05                 ` Mattias Engdegård
2021-08-21  3:21     ` Richard Stallman

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=B4B50ED2-0692-48DF-82A4-977D44C6C3B0@acm.org \
    --to=mattiase@acm.org \
    --cc=50136@debbugs.gnu.org \
    --cc=michael_heerdegen@web.de \
    --cc=monnier@iro.umontreal.ca \
    /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).