unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#50136: 28.0.50; A problem with rx-let expansion
@ 2021-08-20 13:59 Michael Heerdegen
  2021-08-20 14:50 ` Michael Heerdegen
  2021-08-20 15:23 ` Mattias Engdegård
  0 siblings, 2 replies; 13+ messages in thread
From: Michael Heerdegen @ 2021-08-20 13:59 UTC (permalink / raw)
  To: 50136; +Cc: Mattias Engdegård, Stefan Monnier


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.






^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2021-08-23 18:05 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

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