[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnu-arch-users] regexps for namespace

From: Jean Helou
Subject: Re: [Gnu-arch-users] regexps for namespace
Date: Tue, 30 Mar 2004 07:51:17 +0200
User-agent: Mozilla Thunderbird 0.5 (X11/20040306)

Tom Lord wrote:

   > From: Jean Helou <address@hidden>

   > I finally found some time to start hacking namespace.(c|h) to
   > make it use regexps.

Please don't.

Operationally, those pattern-matching checks are rather heavily used
and likely to become moreso.   Meanwhile, especially but not
exclusively in light of Unicode, regexps ain't so cheap.   Oh, they
can be fast (at non-trivial cost in space) and they can be flexible
(e.g., matching a pattern only determined at run-time) --- but they
can't hold a candle to a hard-coded lexer.

You should really only have to put one regexp engine in a program and
the constraints such an engine has to satisfy aren't a very good
description of the problem that namespace.[ch] needs to solve.  The
regexp engine I've chosen for arch is a little too heavyweight for

Changes to the namespace functions should be made in the existing
style.  Yes, it's a bit tedious but it's also kina fun, isn't it?
Trying to write these things up by hand without making a big hairy
mess?  The constraint also helps to keep the namespace simple in

If you _really_ _really_ feel you _must_ use regexps to specify the
namespace, please take the approach of using static compilation of
those regexps.   Fuss around with GNU flex or somesuch.   (But, please
note, there has to be a really good reason for me to make arch depend on flex to be compiled.)

> Next step will convert over_base_name, over_version and over_patch_level > to use regular expressions too.

Stop! Stop!   Go back!   :-)

   > Cheers,


I don't mind extending the old functions instead of using regexps, they were mentionned in the discussion about underscores in email adresses and there was no opposing reaction at the time, so I thought I would just use them, since it's so powerful for pattern matching :-) Yet I must admit it is a bit heavy.

I'll try and transpose my changes in the existing style, that should prove a good exercise.

Two more things :
-Is patch-0 a valid patch level ? (the current over_patch_level thinks it is) -Do you mind if I keep my third step unchanged, meaning I carry on searching files which do their own namespace validation such as inv-ids (which uses regexps btw) and make them use the namespace.[ch] functions ?


Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]