From: Michael Heerdegen <michael_heerdegen@web.de>
To: 50136@debbugs.gnu.org
Cc: "Mattias Engdegård" <mattiase@acm.org>,
"Stefan Monnier" <monnier@iro.umontreal.ca>
Subject: bug#50136: 28.0.50; A problem with rx-let expansion
Date: Fri, 20 Aug 2021 15:59:44 +0200 [thread overview]
Message-ID: <878s0wcj3j.fsf@web.de> (raw)
Hello,
I'm referring to this paragraph in rx.el:
;; FIXME: Consider adding extensions in Lisp macro style, where
;; arguments are passed unevaluated to code that returns the rx form
;; to use.
;; [...]
;; While this would permit more powerful extensions, it's unclear just
;; how often they would be used in practice. Let's wait until there is
;; demand for it.
Ok - here is! I would find that approach much more natural than the
current one. Look:
Already the first `rx-let' pseudo macro I tried hit a problem (bug) with
the current approach:
#+begin_src emacs-lisp
(rx-let ((scatter (string)
(regex (mapconcat #'string (string-to-list string) ".*"))))
(rx (scatter "abc"))) => useless error message
#+end_src
while the following version (the only difference is the argument name)
works as expected:
#+begin_src emacs-lisp
(rx-let ((scatter (s) (regex (mapconcat #'string (string-to-list s) ".*"))))
(rx (scatter "abc"))) ==> "a.*b.*c"
#+end_src
Seems the function form #'string gets replaced and ends as #'"abc" in
the first version because the function name accidentally collides with
the argument name.
Personally I would be more happy with a thing called `rx-macrolet' than
with an extended `rx-let' to support this additional macro-like kind of
syntax.
TIA,
Michael.
next reply other threads:[~2021-08-20 13:59 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-20 13:59 Michael Heerdegen [this message]
2021-08-20 14:50 ` bug#50136: 28.0.50; A problem with rx-let expansion 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
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=878s0wcj3j.fsf@web.de \
--to=michael_heerdegen@web.de \
--cc=50136@debbugs.gnu.org \
--cc=mattiase@acm.org \
--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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.