emacs-devel
[Top][All Lists]
Advanced

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

Re: Saving match data


From: Stefan Monnier
Subject: Re: Saving match data
Date: Wed, 28 Sep 2016 14:25:12 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2.50 (gnu/linux)

> This sounds crazy.  Sorry about this ignorant question: Why do we use
> this model of match data: a global state that is changed as a side
> effect in thousands of circumstances.

That's a design choice with which we've lived for ever.
I don't like it either.  I'd much rather have a regexp-matcher which
returns the match data as a return *value*.

I sometimes dream about extending pcase to support something like

    (pcase <e>
      ((re "^\\(?header:[^:]*\\):\\(?value:.*\\)") (cons header value))
      ...)

of course, it would also take multiple branches and merge them into
a single DFA, and in some versions it even brings world peace,


        Stefan




reply via email to

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