[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Off Topic (was: bug#31544)

From: Alan Mackenzie
Subject: Re: Off Topic (was: bug#31544)
Date: Thu, 24 May 2018 19:57:55 +0000
User-agent: Mutt/1.9.4 (2018-02-28)

Hello, Yuri.

On Thu, May 24, 2018 at 23:53:52 +0700, Yuri Khan wrote:
> On Thu, May 24, 2018 at 11:38 PM Alan Mackenzie <address@hidden> wrote:

> > rx.el uses a wordy syntax, somewhat analagously to Cobol 50 years ago.
> > Its premiss is that it's the terse, dense, austere characters which make
> > a regexp difficult to write and read.  I would suggest that it's more
> > the abstract concepts which cause beginners difficulties, rather than
> > the syntax.  This was true of Cobol 50 years ago, and I think it's
> > always been the case with regexps.

> > That said, rx.el is used ~72 times in 19 files.el in Emacs, so somebody
> > likes it.

> I like rx.el.


> I like it because any reasonably involved rx.el expression will be written
> out on multiple lines, indented, and possibly commented; whereas the
> equivalent plain regexp will be jumbled up on one long line, or else broken
> up into a concat of several arbitrary parts.

Yes.  But...  rx.el needs to be _learnt_.  You cannot, at least not yet,
learn rx.el as an alternative to normal string regexp syntax, because
the string syntax is so common that it _must_ be learnt.  So rx.el is an
optional extra.  It seems unlikely that its use could spread beyond
Emacs, so the effort learning rx.el is going to yield special purpose
knowledge only.

> I like rx.el because its expressions can be navigated structurally, using
> ‘backward-up-list’, ‘forward-sexp’, and the like. The same commands work on
> regular regular expressions only if they have not been broken up for
> readability.

What would be useful would be a function to turn normal regexps into
rx.el syntax.

> I also like rx.el because it allows me to see fewer backslashes,
> double-backslashes, and quadruple-backslashes.

It's when you start seeing triple backslashes that you need to start
worrying.  ;-)

Alan Mackenzie (Nuremberg, Germany).

reply via email to

[Prev in Thread] Current Thread [Next in Thread]