Subject: bug#37440: closed (Re: [PATCH] New rx implementation with extension constructs)

From: [email-masked] (GNU bug Tracking System)
Date: Wed, 25 Sep 2019 21:31:02 +0000

Your bug report

#37440: [PATCH] New rx implementation with extension constructs

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

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

Subject: Re: [PATCH] New rx implementation with extension constructs
From: Paul Eggert <[email-masked]>
To: Mattias Engdegård <[email-masked]>
Cc: [email-masked]
Date: Wed, 25 Sep 2019 14:30:28 -0700
List-Id: <debbugs-submit.debbugs.gnu.org>

Thanks, I installed those patches into master and am closing the bug report.

Subject: [PATCH] New rx implementation with extension constructs
From: Mattias Engdegård <[email-masked]>
To: [email-masked]
Date: Tue, 17 Sep 2019 14:49:51 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

[Continuing from https://lists.gnu.org/archive/html/emacs-devel/2019-09/msg00048.html]

Here is a new rx implementation (faster, easier to work with, fewer bugs, better tests), and, as a separate patch, an rx extension mechanism adding the macros `rx-define', `rx-let' and `rx-let-eval'.

The first patch is a ground-up rewrite of rx. It should be completely compatible.

The second patch adds

(rx-define NAME [ARGS] RX)
(rx-let ((NAME [ARGS] RX) ...) BODY)
(rx-let-eval ((NAME [ARGS] RX) ...) BODY)

as mentioned in the emacs-devel thread earlier. Additions to the manual are included.

Although I believe this to be a consistent and useful design that could be used as-is, some points worth thinking about are:

* Allow for multiple RXs in the definitions, making an implicit (seq ...). This could be done with the Schemeish syntax

(rx-define NAME RX...)
(rx-define (NAME ARGS...) RX...)

which is quite readable as "definition mirrors use". Should then the &rest parameter be declared using a dotted list, as

(rx-define (NAME ARG1 ARG2 . ARG-REST) RX...)

?

* There is some disagreement regarding whether function-like definitions should be standard Lisp expressions instead of the restricted substitution-based macros in this patch, as in

(rx-define whole (x) `(seq bos ,x eos))

I believe the usability of the chosen design is better, but see the point of not reinventing the wheel.

* Not entirely satisfied with the name `rx-let-eval', but unless someone comes up with something better, it stands.