logo       
Google Custom Search
    AddThis Social Bookmark Button

Re: Getopt/OptParse (the saga continues...): msg#00310

Subject: Re: Getopt/OptParse (the saga continues...)
On Tue, 2004-08-24 at 18:38, Bardur Arantsson wrote:
> On Tue, Aug 24, 2004 at 10:23:45AM +0200, Nicolas Cannasse wrote:

> There are two things that use it:
> 
> 1) Splitting text into chunks by whitespace (for the
> formatting functions). I think it might be better to just
> write a general split_by_chars function which can split on
> any of a set of delimiter chars and put that into
> ExtString. What do you think?
> 
> 2) To do string replacement of "%prog" in usage/error
> messages. Again, a preliminary fix using String.replace
> should be almost trivial, but I would like to do it right,
> s.t.
> 
>          "%prog"    -> <program name>
>          "%program" -> "%program"
>          "%%prog"   -> "%prog"
>        "%prog|"   -> <program name>"|"
> 
> I'll submit a patch bit later.

Yeah -- I'd do two things:

(1) Hack a solution that works for you.
(2) Consider what kinds of library functions would 
have save you that work.

This (a) gets your code working an useful and
(b) provides usage data which is needed as a 
starting point for desiging components.

My personal take is that the correct way to handle
this is with a language extension supported by 
a library which provides a proper set of tools
for manipulating regular sets of strings.

Str and PCRE are examples of such tool kits,
I just think both are badly designed.

This isn't a criticism of the ocaml wrapper
of PCRE -- the underlying notion that a
string is a regular expression is seriously
flawed and shouldn't be allowed in a basic
toolkit.

The thing is -- string_split is a useful function
BUT it is really a special case of the more
general notion of a regular lexer which splits
a string into regular lexemes.

-- 
John Skaller, mailto:skaller@xxxxxxxxxxxx
voice: 061-2-9660-0850, 
snail: PO BOX 401 Glebe NSW 2037 Australia
Checkout the Felix programming language http://felix.sf.net





-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285



Try Searching:
servers, voip, java, networking, microsoft ...
<Prev in Thread] Current Thread [Next in Thread>