[30] in Coldmud discussion meeting

root meeting help first previous next next in chain last in chain last

Regular expressions

daemon@ATHENA.MIT.EDU (Tue Nov 16 16:52:27 1993 )

To: coldstuff@MIT.EDU
Date: Tue, 16 Nov 93 16:42:42 EST
From: Greg Hudson <ghudson@MIT.EDU>

I'm currently leaning against regular expressions.

My reasons:

First, I already provide two matching primitives, match_pattern() and
match_template(), which should handle some of the cases.  (I'm
interested in hearing about cases where these aren't useful.)  I don't
want to provide a complicated tool which will be used for tasks for
which simpler tools are more appropriate.

Second, regular expressions are slow compared to simpler matching
primitives.  Precompiling them helps (I would probably implement this
internally, with some form of caching, rather than add another data
type), but don't solve the problem.

Third, regular expressions are complicated.  I can fairly easily link
in, say, the gnu regexp library, but this means I have to worry about
the GPL, the portability issues associated with gnu code, all the
cruft that comes with general reusable code (fairly minimal in this
case, granted), etc..

Fourth, regular expressions are unreadable.  You can do wonderful
things with them, but they're essentially a write-only language.

Fifth, I'm kind of wary of totally in-server robots.  I think that
decision mechanisms in robots should generally be done client-side
(there are plenty of client tools for this).

Sixth, regexps are not a backward-incompatible change, so they can be
added to a post-1.0 release fairly easily.

That said, I would be happy to implement a simpler pattern-matching
mechanism (or perhaps modify the behavior of match_pattern()) to
handle common cases that the current matching primitives aren't good
for, if they can be organized well enough.  I'll talk to Quinn about
AHaB's patterns and see what I can do.