From: Alec Muffett <alec.muffett@gmail.com>
To: Rob Pike <robpike@gmail.com>
Cc: Marc Rochkind <mrochkind@gmail.com>,
Will Senn <will.senn@gmail.com>, TUHS <tuhs@tuhs.org>
Subject: [TUHS] Re: regex early discussions
Date: Mon, 4 Mar 2024 08:43:48 +0000 [thread overview]
Message-ID: <CAFWeb9J1esmaLfqKjm0q5YQ09krqHz-11zXaLQDj7w6pHVz2yQ@mail.gmail.com> (raw)
In-Reply-To: <CAKzdPgyeVyBWV6M87X-gicR52t3zfeH6U4ZyFgbL3cR4WH2cuA@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1236 bytes --]
On Mon, 4 Mar 2024, 08:27 Rob Pike, <robpike@gmail.com> wrote [to Larry]
Oh happy days. Hi Rob, loved the book.
If that's really true, that you learned from Spencer's library, then you
> didn't learn the most important thing about them, which is the automata
> theory that guarantees their performance is always linear. Not to take
> anything away from Henry, who admitted at the time that it could be slow
> for bad expressions, but we're still paying the price for refusing to
> connect "regex" with the theory that created them, ignoring it in fact.
>
I once got into a bunfight with a Googler on the topic of coding interview
questions, on a related matter. He was promulgating a regular expression to
correctly match/parse-out legitimate dotted-quad IPv4 addresses, including
bounds-checking the octets to be in the range 0..255, and arguing that it
since it was going to be run through a DFA that it was a sunk cost for
efficiency and therefore perfect.
The result looked like line noise, and he was perturbed that I said I would
prefer to take a much simpler (NFA?) RE, parse out the ints and
bounds-check them, just to reduce cognitive load and increase
maintainability of code.
We didn't really come to an agreement.
-a
[-- Attachment #2: Type: text/html, Size: 2156 bytes --]
next prev parent reply other threads:[~2024-03-04 8:44 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-04 1:30 [TUHS] " Will Senn
2024-03-04 2:03 ` [TUHS] " Marc Rochkind
2024-03-04 3:38 ` Larry McVoy
2024-03-04 4:18 ` Rich Salz
2024-03-04 7:51 ` Alec Muffett
2024-03-04 8:17 ` Rob Pike
2024-03-04 8:43 ` Alec Muffett [this message]
2024-03-04 14:25 ` Jan Schaumann via TUHS
2024-03-04 10:21 ` Bakul Shah via TUHS
2024-03-04 14:34 ` Larry McVoy
2024-03-04 7:10 ` Otto Moerbeek via TUHS
2024-03-04 7:19 ` Dave Long
2024-03-04 7:25 ` arnold
2024-03-04 12:05 ` Ralph Corderoy
2024-03-04 13:01 ` arnold
2024-03-04 7:25 ` Otto Moerbeek via TUHS
2024-03-04 12:00 ` Peter Weinberger (温博格) via TUHS
2024-03-04 17:05 ` Will Senn
2024-03-04 18:43 ` Rich Salz
2024-03-04 20:57 ` Bakul Shah via TUHS
2024-03-04 21:05 ` Steffen Nurpmeso
2024-03-04 13:17 ` Alan D. Salewski
2024-03-04 16:57 ` Clem Cole
2024-03-04 18:38 ` Phil Budne
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=CAFWeb9J1esmaLfqKjm0q5YQ09krqHz-11zXaLQDj7w6pHVz2yQ@mail.gmail.com \
--to=alec.muffett@gmail.com \
--cc=mrochkind@gmail.com \
--cc=robpike@gmail.com \
--cc=tuhs@tuhs.org \
--cc=will.senn@gmail.com \
/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.
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 NNTP newsgroup(s).