Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[Caml-list] Str replacement

2 views
Skip to first unread message

skaller

unread,
Aug 4, 2007, 6:30:45 AM8/4/07
to caml...@yquem.inria.fr
When is the Str module going to be extended to provide
re-entrant operations??

I understand (perhaps incorrectly) that Xavier rewrote the
code for this module, and assume the underlying functionality
is re-entrant?

For compatibility the old broken interface is still available,
which is fine, but a re-entrant interface should be provided.
IMHO. It's disgusting, having a library like this in a functional
programming language. Even Python gets this right.

--
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net

_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

Xavier Leroy

unread,
Aug 5, 2007, 12:08:01 PM8/5/07
to skaller, caml...@yquem.inria.fr
> When is the Str module going to be extended to provide
> re-entrant operations??

When someone designs a new interface to Str and gets it approved by a
few respectable members of this community. A proof-of-concept
implementation wouldn't hurt either, although I'm OK with writing the
final implementation. It's the API for which I don't have ideas.

> I understand (perhaps incorrectly) that Xavier rewrote the
> code for this module, and assume the underlying functionality
> is re-entrant?

Correct.

- Xavier Leroy

Gerd Stolpmann

unread,
Aug 5, 2007, 3:33:26 PM8/5/07
to Xavier Leroy, caml...@yquem.inria.fr, skaller
Am Sonntag, den 05.08.2007, 18:05 +0200 schrieb Xavier Leroy:
> > When is the Str module going to be extended to provide
> > re-entrant operations??
>
> When someone designs a new interface to Str and gets it approved by a
> few respectable members of this community. A proof-of-concept
> implementation wouldn't hurt either, although I'm OK with writing the
> final implementation. It's the API for which I don't have ideas.

What about this:

https://godirepo.camlcity.org/wwwsvn/trunk/code/src/netstring/netstring_str.mli?rev=1003&root=lib-ocamlnet2&view=auto

This is the reentrant API used in Ocamlnet. Once upon a time it was
really based on Str as backend, but we switched to Pcre for its extended
capabilities. The core idea is that code like

if Str.string_match re s 0 then
let u = Str.matched_group 1 s in
do_this
else
do_something_else

is replaced by

match Str.string_match re s 0 with
Some m ->
let u = Str.matched_group m 1 s in
do_this
| None ->
do_something_else

which is not very much longer. All intermediate state is kept in m.

Gerd
--
------------------------------------------------------------
Gerd Stolpmann * Viktoriastr. 45 * 64293 Darmstadt * Germany
ge...@gerd-stolpmann.de http://www.gerd-stolpmann.de
Phone: +49-6151-153855 Fax: +49-6151-997714
------------------------------------------------------------

skaller

unread,
Aug 5, 2007, 8:13:27 PM8/5/07
to Xavier Leroy, caml...@yquem.inria.fr
On Sun, 2007-08-05 at 18:05 +0200, Xavier Leroy wrote:
> > When is the Str module going to be extended to provide
> > re-entrant operations??
>
> When someone designs a new interface to Str and gets it approved by a
> few respectable members of this community. A proof-of-concept
> implementation wouldn't hurt either, although I'm OK with writing the
> final implementation. It's the API for which I don't have ideas.
>
> > I understand (perhaps incorrectly) that Xavier rewrote the
> > code for this module, and assume the underlying functionality
> > is re-entrant?
>
> Correct.

Ah, this is all good news! A proof of concept could probably
be trivially implemented, just using the old interface.

--
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net

_______________________________________________

0 new messages