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 (03:54)
From: skaller <skaller@u...>
Subject: Re: [Caml-list] Thread safe Str
On Tue, 2005-01-11 at 07:25, Martin Jambon wrote:

> However, my concerns are more about how to integrate regular expressions
> in the language so that they can be checked at compile-time just like the
> rest of the program. My Camlp4 syntax extension
> (http://martin.jambon.free.fr/micmatch.html) works just fine for this
> purpose and I am not asking for any change in the core OCaml syntax ;-)

But Str is a hack. Like all NFA based solutions, it's unreliable
because it is unsound: possible infinite recursion, indeterminate
capture results, and exponential performance. 

In addition, regular expressions have poor scalability and
fail to provide simple i18n support.

I think Felix does this the right way: core language support
for regular definitions, linear classification and tokensisation,
and no captures. If you want captures use the proper tool,
namely a parser, which is also supported directly in the language
(this is more problematic due to the number of parsers around,
Felix currently provides the GLR parser Elkhound).

So I would love to see integration of regexp support in Ocaml
but I'm very much against Str. If some technology is to
be integrated, please use the right technology and 
integrate Ocamllex.

See the ulex package for a model. The problem with micmatch
is precisely that it does use Str.

BTW: it probably doesn't work either, due to the bug in Str
I mentioned in an earlier post.

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