|
From: | Dmitry Gutov |
Subject: | Re: combining cond and let, to replace pcase. |
Date: | Sun, 19 Nov 2023 15:59:46 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 |
On 19/11/2023 15:08, Eli Zaretskii wrote:
Actually both and none, this is exactly the point I raised in my other reply - both have exactly the same complexity, and it is totally subjective and only habit which one you prefer.It isn't only that. It is also that the obscure and subtle nature of regexp strings makes it easy to make mistakes. Just look at the sheer number of regexp mistakes uncovered in our code base by Mattias Engdegård during the last year. It isn't an accident.
pcase is much better guarded against programmer mistakes because in a lot of cases typos or misunderstandings will be highlighted by the byte-compiler (potentially, with flymake directly in the buffer, which I also recommend everyone to enable).
Both rx and string regexps aren't able to take advantage of such. Mattias's checker took a lot of steps toward the same functionality, but it's ultimately limited, e.g. because we don't annotate regexps any differently from strings in the code.
[Prev in Thread] | Current Thread | [Next in Thread] |