gnu-arch-users
[Top][All Lists]
Advanced

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

Re: [Gnu-arch-users] Re: Obsoleting abrowse


From: John Arbash Meinel
Subject: Re: [Gnu-arch-users] Re: Obsoleting abrowse
Date: Sat, 30 Jul 2005 21:32:09 -0500
User-agent: Mozilla Thunderbird 1.0.2 (X11/20050404)

Matthieu Moy wrote:
> David Allouche <address@hidden> writes:
> 
> 
>>This one bothers me a bit for a couple of reasons:
>>
>>      * The repetitive use of ".*"
>>      * The fact that your regexp does not _really_ means what it
>>        appears to mean, because "." still matches any single character.
> 
> 
> Well, this is a problem with regular expressions, but for anyone used
> to grep, sed, perl, ..., it shouldn't be a problem.
> 

The other thing to consider, is that because the '/' only occurs 1 time
in all fully qualified revision names A.*/bazaar.* does indeed match to
the correct '/' and would work exactly the same way if you were using
grep to do the processing.

Now if you did "A.*bazaar.*" that would be something different, because
you don't have an anchor point for where bazaar must occur.
Or if you had multiple possibilities for where the '/' could occur.

> 
>>At this point you could guess that I'm advocating the use of globs
>>instead of regexps by default.
>>
>>I'm suggesting the switches
>>
>>      * "-S, --string" interpret the argument as a fixed string
>>      * "-G, --glob" interpret the argument as a glob (default)
>>      * "-R, --regex" interpret the argument as a regular expression
> 
> 
> That's an option. I think glob would be sufficient in 99.999% of the
> case (who would want to write things like "a(bc)*d" to match against
> file or branch names).
> 
> I have two arguments againts globs:
> 
> * Arch's tradition is to use regexp ({arch}/=tagging-method, argument
>   of "baz archives", ...)
> 
> * I don't know how to implement globs ;-).

I love regexes, once I learned the syntax, I truly prefer them. But I
realize most people find globs easier to understand and use.

I've looked into it a little bit, and I realized that transforming a
glob into a regex is rather trivial. Because you just can't express that
much stuff in glob syntax, so they don't use many features of regex.

Specifically "*" => ".*", "?" => ".", and from there it just depends how
fancy your glob syntax is (some globs support a[bc]d, but that is
already regex syntax. I suppose the biggest thing is that you might need
to know what characters to escape, to prevent use of extra regex features.

The other answer is that the function "fnmatch" is the standard POSIX
glob function. int fnmatch(const char* pattern, const char *string, int
flags);
I'm guessing that hackerlab has a similar function, but it may not,
since it generally prefers to use it's bundled regex library.

> 
> 
>>Generally, I like the "no implicit wildcard" approach, even though it
>>seems a bit cumbersome at first, as I expect it to be compatible with
>>the future branch directory that will take the place of the a/c-b-v
>>directory when namespace is decoupled from storage and identification.
> 
> 
> Actually, rbrowse is already going in that direction. categories,
> branches and versions are never accessed nor displayed separately.
> 

I'm curious how it would work in something like the current baz-ng
format, where really it is just the path/url to the directory which
defines the "archive". It might just be that baz-ng is planning to
handle some sort of hierarchical arch-like structure, and has just not
gotten there yet.

John
=:->

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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