GNU bug report logs -
#58727
29.0.50; rx doc: Semantics of RX...
Previous Next
Reported by: Michael Heerdegen <michael_heerdegen <at> web.de>
Date: Sun, 23 Oct 2022 02:33:02 UTC
Severity: normal
Found in version 29.0.50
Done: Michael Heerdegen <michael_heerdegen <at> web.de>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
24 okt. 2022 kl. 04.34 skrev Michael Heerdegen <michael_heerdegen <at> web.de>:
>> The rule is implicit concatenation unless specified otherwise; maybe
>> we could say that in the leading paragraph. (`or` is the only place
>> where concatenation isn't done.)
>
> Yes, that would be good.
Now added.
> I meant the implicit shy
> grouping added in the return value
Yes, and this is simply not a problem in rx, nor on the abstract regexp level -- it's just a feature of the surface syntax of string regexps but that's not something that the rx docs are or should be preoccupied with.
(For that matter, 'shy grouping' is terrible terminology: it's obscure wording for something that is generally known as bracketing to the general population.)
> (rx (or "ab" "cd")) ==> "\\(?:ab\\|cd\\)"
> ^^^^^ ^^^
This happens to be a cosmetic flaw in rx: in this case the brackets shouldn't be there at all, but getting rid of them is currently more trouble than it's worth. It does not affect matching performance. See it as an excess of packaging material which does not increase the shipping costs.
>> The manual provides corresponding string-notation constructs for
>> orientation only. This is important -- rx forms are defined by their
>> semantics, not by what strings they translate to.
>
> Is this trivial however? Is it clear that, even for people that see rx
> more as a translator to stringish regexps, `rx' is that smart?
It's not that rx is smart, it's that it's not completely broken. Mentioning that rx adds brackets now and then is tantamount to saying that it's not buggy.
We don't say that the byte-compiler emits jump instructions as needed, not just because it's superfluous information but also because such a statement suggests that it's not.
> A sentence like "rx forms are defined by their semantics" would help to
> make that clear I think.
Well, I added a phrase to that effect as well.
Thank you for your comments and suggestions!
This bug report was last modified 2 years and 213 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.