emacs-devel
[Top][All Lists]
Advanced

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

Re: "Raw" string literals for elisp


From: Stefan Kangas
Subject: Re: "Raw" string literals for elisp
Date: Wed, 8 Sep 2021 17:41:47 +0200

Mattias Engdegård <mattiase@acm.org> writes:

> Elisp actually has a much better regexp syntax than most other languages:
>
> > "\\(\\\\\\\\\\)\\(?:\\(\\\\\\\\\\)\\|\\((\\(?:\\?[0-9]*:\\)?\\|[|)]\\)\\)"
>
> Today that would be written
>
> (rx (group "\\\\")
>     (or (group "\\\\")
>         (group
>          (or (seq "("
>                   (? "?" (* digit) ":"))
>              (in ")|")))))
>
> which is much more readable and maintainable and less error-prone than what 
> you would get with a new string syntax.

That's true.  I hope that we can preload rx and use it more.

But ELisp is also intended for end-users that want to hack together
some quick command.  They may be completely uninterested in spending
even a minimum of time to learn rx, and prefer instead to use the more
standard form they already know so they can just get their job done.

I'm not even sure that rx is the unequivocal first choice among
hardcore ELisp programmers.



reply via email to

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