unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Mattias Engdegård" <mattias.engdegard@gmail.com>
To: Michael Heerdegen <michael_heerdegen@web.de>
Cc: 58727@debbugs.gnu.org
Subject: bug#58727: 29.0.50; rx doc: Semantics of RX...
Date: Mon, 24 Oct 2022 14:49:25 +0200	[thread overview]
Message-ID: <EEC04582-FFFE-48FD-ABBF-DC3837954AB5@gmail.com> (raw)
In-Reply-To: <87pmeic5lq.fsf@web.de>

24 okt. 2022 kl. 04.34 skrev Michael Heerdegen <michael_heerdegen@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!






  reply	other threads:[~2022-10-24 12:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-23  2:32 bug#58727: 29.0.50; rx doc: Semantics of RX Michael Heerdegen
2022-10-23 16:14 ` Mattias Engdegård
2022-10-24  2:34   ` Michael Heerdegen
2022-10-24 12:49     ` Mattias Engdegård [this message]
2022-10-25  2:49       ` Michael Heerdegen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=EEC04582-FFFE-48FD-ABBF-DC3837954AB5@gmail.com \
    --to=mattias.engdegard@gmail.com \
    --cc=58727@debbugs.gnu.org \
    --cc=michael_heerdegen@web.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).