benefits of SRE syntax Michael Montague (16 Oct 2013 18:44 UTC)
Re: benefits of SRE syntax Roderic Morris (16 Oct 2013 19:23 UTC)
Re: benefits of SRE syntax Alex Shinn (20 Oct 2013 07:13 UTC)
Re: benefits of SRE syntax Per Bothner (16 Oct 2013 19:34 UTC)
Re: benefits of SRE syntax Alex Shinn (20 Oct 2013 14:21 UTC)
Re: benefits of SRE syntax John Cowan (20 Oct 2013 16:30 UTC)
Re: benefits of SRE syntax Per Bothner (20 Oct 2013 17:16 UTC)
Re: benefits of SRE syntax John Cowan (20 Oct 2013 17:50 UTC)
Re: benefits of SRE syntax Alex Shinn (20 Oct 2013 21:17 UTC)
Re: benefits of SRE syntax John David Stone (16 Oct 2013 20:39 UTC)
Re: benefits of SRE syntax Peter Bex (16 Oct 2013 20:50 UTC)
Re: benefits of SRE syntax Alex Shinn (17 Oct 2013 08:41 UTC)

Re: benefits of SRE syntax John David Stone 16 Oct 2013 20:01 UTC

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Michael Montague writes:

 > Maybe I am being a heretic, but what are the benefits of the SRE syntax?

        It reflects the tree-like structure of regular expressions as a
data type.  What you're calling the "traditional syntax" flattens that
structure into a linear string, which the reader has to parse in order to
recover the structure.

        The SRE syntax also supports modular design and component reuse
better than the traditional syntax.  Scheme's built-in binding mechanisms
can be used to give names to useful and interesting subexpressions.  Such
subexpressions can be tested independently.  The traditional syntax fails
in all these respects, because the only intuitive way to combine regular
expressions in that syntax is by string concatenation, which is error-prone
(particularly, but not exclusively, when there are submatch assignments)
and comparatively inflexible.

 > The beginning of the rational notes that "regular expressions are the
 > lingua franca of string matching today". Part of that lingua franca is
 > the traditional syntax of regular expressions.

        Yes, it's a sad story.  If the tool-builders who implemented Unix
had thought carefully about the traditions relating to regular expressions
that the designers of SNOBOL4 had already tried to establish, we wouldn't
find it necessary to reinvent them every few years.  One weeps to think of
all the agonizing, needless labor that programmers have done over the years
in trying to understand and debug regular expressions in traditional
syntax.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.9 <http://mailcrypt.sourceforge.net/>

iQIcBAEBAgAGBQJSXvBVAAoJEG4s3o5S5qkZj+wP/0mdyfsL4P0ory1vh0TlXQbg
iFKkLqyK7GKzONdqZtvLr2YHxb6t12aFhv3pMsCIQ17OvXhbP6kAxEe2WhS3EQDB
ORIEGsnzarojyyt+a9h2td2KkuUKtlyijx5wndDzh7aBQr3Thhl8DrJofwuCK/0F
mHE6hJU+6bhXJnxB9KQ6GhK0bOaPUZyh286gzR77P3j4ZKsVCjbZ1CtGsxNHUodF
BpeTb4DtotR+3/nwv2A4RM55xTjJTinMu+tFqjlxU/jpvKBwQuVq7zNH8q+xz/MV
mxmsJbNg+Uvabeo2x6S6XkM61dcFgPyNpwGB7MjAdjppKBwmYR0MGWn77Sy2xHK6
ZstN6dPpMZhHEL2vm+JRhwgpSjPTQMxYUoZsZWoBB1KJJh9T5tbhU3hsNmBuDh7a
5EbNHYzmkzEN9x/2V45UjKk5RWwuzrXCEkQaIULhPguajiCnQ0bwm46jBO3xBj7Y
CqBx5UtVFAvEaciGbfbhB4pElZq1fF/dYtag3rbzmbD2xnKbJbR9GrJ3hNbnmSV7
8WAPfhn2K1faEfk5t5Aikz0g17Ufw19nmIdpKYTkdi+pOVk47k47cmJKO07TV5cv
Uq3ih5M7JekgiMqG+N8uGyRkwbcPphkbssm/o/7yN3qfdDXK2gKND3I3VeNUeQvU
qWlczSKu8IyiOtp7kX4T
=T7lt
-----END PGP SIGNATURE-----