English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
Thread safe Str
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2005-01-11 (06:41)
From: Chris King <colanderman@g...>
Subject: Re: [Caml-list] Thread safe Str
On Mon, 10 Jan 2005 16:49:17 +0100, Xavier Leroy <Xavier.Leroy@inria.fr> wrote:
> Besides being thread-safe, the new API could also expose
> the abstract syntax tree for regexps, allowing easier construction of
> complex regexps by programs than can be done by working at the level
> of the string representation of regexps.

Nifty!  This is something I'd really like to see.

> But if a few persons on this list want to team up to
> design an API, that would be wonderful indeed.

I was actually considering writing a wrapper for Str modeled after
Python's object-oriented re library, which I've found to be very
well-designed (much better than any syntax-based solution).  Being
relatively new to OCaml, I'm not sure that classes in the standand
library are considered kosher; would it be preferable to use types
rather than classes?

Also, Python (and IIRC Perl also) support "raw" strings, strings which
do not interpret escape sequences.  These are very useful for avoiding
extra backslash garbage in regular expressions; and (I assume) could
be easily added to OCaml to ease the usage of regexps.