all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 31698@debbugs.gnu.org
Subject: bug#31698: 27.0; `rx' help: Show equivalent regexp constructs
Date: Sun, 3 Jun 2018 13:02:53 -0700 (PDT)	[thread overview]
Message-ID: <2c335f8a-d6df-45b1-b1dd-a7f42dbcb584@default> (raw)
In-Reply-To: <83efhnd8p1.fsf@gnu.org>

> > Perhaps its not-so-widespread use is _partly_ due to
> > the lack of more helpful doc?
> 
> I very much doubt that, and the recent discussion seems to concur.

No, I don't think it does.  The recent discussion pointed
out other reasons why it is not more widely used.  And I'm
one of those in that discussion who explicitly agreed with
those other reasons.

And FWIW I think those reasons (verbosity etc.) are more
important than the reason given in this report.  There is,
however, nothing in that discussion that argues that the
reason given here is not relevant.

> > I'm thinking, in particular, of people who are familiar
> > with regexps (Elisp or other) but not with `rx'.
> 
> I'm one such person, and yet I see no problem with the
> current documentation.

Yes, you've made that clear.  But please "feel free" to
say it again.

I too am one such person, and guess what... 

> > > > 2. Please document (in the doc string of `rx', if nowhere else) the
> > > >    correspondences between each of the `rx' constructs and regexp
> > > >    syntax.  At least please document the most important ones.  For
> > > >    example, `zero-or-more' presumably corresponds to postfix regexp
> > > >    char `*'.
> > >
> > > Really?  Doesn't "zero-or-more" define the effect as 
> > > clearly as possible?  I think it does.
> >
> > Perhaps you're missing the point.  Yes, `zero-or-more'
> > describes the effect.  No, it does not tell you which
> > `rx' construct corresponds to `*' in a regexp.  Again,
> > I'm thinking, in particular, of people who are familiar
> > with regexps (Elisp or other) but not with `rx'.
> 
> Again, I'm one such person, and it was immediately clear
> to me what 'zero-or-more' translates to.

Again, it's about the other direction.  Not finding out
what `zero-or-more' means or translates to in a regexp,
but finding out what `*' in a regexp translates to in `rx'.

Quick, what does a shy regexp group translate to in `rx'?
(There is no correspondence, because none is needed.)

In general, it's _not obvious_ how a given regexp would
be translated to `rx'.  It would be helpful to be able
to easily translate regexps to `rx' sexps.

The doc for `rx' could help with that by providing an
explicit mapping between the two.  Do you disagree that
that would be helpful?

The mapping exists in the code, of course, but only in
the direction rx-to-regexp.  For someone new to `rx'
who wants to analyze a regexp into its `rx' constituents,
or who wants to replace a regexp by an equivalent `rx'
sexp, documenting a regexp-to-rx mapping would help.

And (as you've said more than once) "I'm one such person."

In addition, it would be good to have a Lisp function
that performs a regexp-to-rx translation.

> > You must scan 212 lines (!) of doc string before you get to
> > `and' (aka `seq', aka `:', aka `sequence'), which tells you
> > how to write a sequence of patterns.
>
> There will always be something for which you will need to scan 212
> lines before you get to it.  There isn't too much one can say on a
> single line, so something's gotta give.

That's an argument that says only that different orders
are possible.  Unless you are trying to make the even
less useful argument that the order chosen makes no
difference.

Not everything can be stated first, clearly.  Such a
truism has no relevance for choosing which order to use.
Different orders serve different purposes.

> > > Having said all that, if someone wants to work on this and thinks
> > > they can improve on the current state of affairs, feel free.
> >
> > I certainly _hope_ people feel free to help.  I guess
> > you say that to make clear that you are leaving the
> > request open.
> 
> Did you see me close it?

Did I say you closed it?





      reply	other threads:[~2018-06-03 20:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-03 17:01 bug#31698: 27.0; `rx' help: Show equivalent regexp constructs Drew Adams
2018-06-03 17:14 ` Eli Zaretskii
2018-06-03 17:53   ` Drew Adams
2018-06-03 18:30     ` Eli Zaretskii
2018-06-03 20:02       ` Drew Adams [this message]

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

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

  git send-email \
    --in-reply-to=2c335f8a-d6df-45b1-b1dd-a7f42dbcb584@default \
    --to=drew.adams@oracle.com \
    --cc=31698@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.