Subject: bug#36237: Support (rx (and (regexp EXPR) (regexp-quote EXPR)))

From: Stefan Monnier <[email-masked]>
Date: Sun, 16 Jun 2019 08:35:01 -0400

> I'm not sure that it is, e.g., python-rx might bind it too (if it
> weren't for the fact that python.el needs to maintain backwards
> compatibility with older Emacs).

I think that would still be "python-rx using internals of rx".
And that could be fixed if we can rewrite it with rx-macrolet, right?

> regexp does exactly what it did before, i.e., it accepts only a constant
> string.  Likewise regexp-quote accepts only a constant string, which
> makes it pointless to use in rx-to-string (just use a plain STRING
> directly), but I didn't disallow it.

Good, thanks.

>>> - What is now the correct way of including a compile-time regexp expression,
>>> such as a defconst? (regexp (eval-when-compile EXPR))? Still a mouthful, but
>>> perhaps outside the scope of this bug.
> Oh, hmm.  That might be a reason to keep using `eval'.

It could make people reluctant to change, yes, but that still wouldn't
be a valid reason in my book.

>> FWIW, I have the impression that in most cases where this could be
>> useful, a better solution would be to provide something like
>> `rx-defmacro` and/or `rx-macrolet`.
> I guess that could replace the "old crusty" rx-constituents thing too.

That's the idea, yes.

        Stefan