Subject: bug#50136: closed (Re: 28.0.50; A problem with rx-let expansion)

From: [email-masked] (GNU bug Tracking System)
Date: Mon, 23 Aug 2021 18:06:01 +0000

Your bug report

#50136: 28.0.50; A problem with rx-let expansion

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
50136: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=50136
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: 28.0.50; A problem with rx-let expansion
From: Mattias Engdegård <[email-masked]>
To: Michael Heerdegen <[email-masked]>
Cc: [email-masked], Stefan Monnier <[email-masked]>
Date: Mon, 23 Aug 2021 20:05:26 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

23 aug. 2021 kl. 18.59 skrev Michael Heerdegen <[email-masked]>:

> Maybe at least one sentence about that this mechanism just performs
> trivial substitution?

I didn't do that now, because I couldn't see how it could be interpreted otherwise (and there's the manual link).

> I find the term "user-defined" distracting, because anybody (including
> library and package developers) is "affected".  Apart from that, ok for
> me.

Thank you, changed.

> Didn't try the example, but it looks good.

Thanks for looking at it. Good examples are always hard to write!

> | (eval EXPR)    Match the rx sexp from evaluating EXPR at compile time.
> 
> can we say "expansion time" instead of "compile time"?

We can, and now do!

Closing; I think we're done here (complain if not).

Subject: 28.0.50; A problem with rx-let expansion
From: Michael Heerdegen <[email-masked]>
To: [email-masked]
Cc: Mattias Engdegård <[email-masked]>, Stefan Monnier <[email-masked]>
Date: Fri, 20 Aug 2021 15:59:44 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

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.