[Top][All Lists]

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

Re: master ea93326: Add `union' and `intersection' to rx (bug#37849)

From: Stefan Monnier
Subject: Re: master ea93326: Add `union' and `intersection' to rx (bug#37849)
Date: Fri, 13 Dec 2019 12:13:19 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

> An interesting suggestion, but exactly how would that model work? Consider:
>  (rx-define ident-chars (any "a-z0-9"))
>  (rx-define op-chars (any "+*/" ?-)
> To form the union of the two, 'any' needs to be allowed inside 'union':
>  (any (union ident-chars op-chars))

Indeed to avoid this, we'd have to do something like

    (rx-define-charset ident-chars "a-z0-9")
    (rx-define-charset op-chars (union "+*/" ?-))

and then

     ... (any (union ident-chars op-chars)) ...

Is it worth the trouble?

> Speaking of 'or', we still haven't figured out what to do about regexp-opt
> in rx. Currently, the answer is something like
> (eval (regexp-opt STRINGS)), which isn't ideal.

We could try and automatically determine inside `or` when regexp-opt can
be used.  That doesn't sound like much fun, tho.


reply via email to

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