caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Str replacement
@ 2007-08-04 10:28 skaller
  2007-08-05 16:05 ` [Caml-list] " Xavier Leroy
  0 siblings, 1 reply; 4+ messages in thread
From: skaller @ 2007-08-04 10:28 UTC (permalink / raw)
  To: caml-list

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Caml-list] Str replacement
  2007-08-04 10:28 Str replacement skaller
@ 2007-08-05 16:05 ` Xavier Leroy
  2007-08-05 19:30   ` Gerd Stolpmann
  2007-08-05 23:22   ` skaller
  0 siblings, 2 replies; 4+ messages in thread
From: Xavier Leroy @ 2007-08-05 16:05 UTC (permalink / raw)
  To: skaller; +Cc: caml-list

> 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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Caml-list] Str replacement
  2007-08-05 16:05 ` [Caml-list] " Xavier Leroy
@ 2007-08-05 19:30   ` Gerd Stolpmann
  2007-08-05 23:22   ` skaller
  1 sibling, 0 replies; 4+ messages in thread
From: Gerd Stolpmann @ 2007-08-05 19:30 UTC (permalink / raw)
  To: Xavier Leroy; +Cc: skaller, caml-list

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 
gerd@gerd-stolpmann.de          http://www.gerd-stolpmann.de
Phone: +49-6151-153855                  Fax: +49-6151-997714
------------------------------------------------------------


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Caml-list] Str replacement
  2007-08-05 16:05 ` [Caml-list] " Xavier Leroy
  2007-08-05 19:30   ` Gerd Stolpmann
@ 2007-08-05 23:22   ` skaller
  1 sibling, 0 replies; 4+ messages in thread
From: skaller @ 2007-08-05 23:22 UTC (permalink / raw)
  To: Xavier Leroy; +Cc: caml-list

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-08-06  0:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-04 10:28 Str replacement skaller
2007-08-05 16:05 ` [Caml-list] " Xavier Leroy
2007-08-05 19:30   ` Gerd Stolpmann
2007-08-05 23:22   ` skaller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).