caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Markus Mottl <markus@mail4.ai.univie.ac.at>
To: Berke Durak <berke@altern.org>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] String.unescaped and some other little pitiful laments
Date: Tue, 10 Jul 2001 20:55:34 +0200	[thread overview]
Message-ID: <20010710205534.B29850@fichte.ai.univie.ac.at> (raw)
In-Reply-To: <20010710200734.B10265@localhost.localdomain>; from berke@altern.org on Tue, Jul 10, 2001 at 20:07:34 +0200

On Tue, 10 Jul 2001, Berke Durak wrote:
> Also I'd like to see those horrible functions returning parameters in
> global variables be eradicated, such as those that can be found in the Str
> (regular expression) module. Is there a complete, typeful regular
> expression package entirely written in Ocaml ?

Unfortunately not. My Pcre-library has to interface to C to access the
matching engine, but the huge rest of the functions that build on it
are written in OCaml. In contrast to the Str-library, the Pcre-library
is fully reentrant, which is nice if you want to use it with threads or
want to interleave several matches with others.

If somebody wants to give it a try, the SML-entry in the language shootout
implements a regexp-library with NFAs and DFAs. I haven't given it a
closer look yet, but performance looks excellent:

  http://www.bagley.org/~doug/shootout/bench/regexmatch/regexmatch.mlton

> Many people on this list are talking lighthearted about functions
> such as Obj.magic. These functions are pure evil. It makes me sorry
> to see that my favorite language has an unsafe and ugly type casting
> function. Modules using such features should be flagged as ``evil'',
> and the use of these functions should not be publicly advocated.

I don't think anybody would talk lightheared about "Obj.magic". It happens
extremely seldom that one needs it, e.g. when you want to initialize
the contents of a reference with a fully polymorphic value, which
you cannot necessarily create (and matches on optional values with an
"assert false"-branch look really ugly and require many more lines, too).

The latter problem could be eliminated in some cases if one could raise
exceptions with polymorphic contents (by binding the type variable in
some enclosing expression in which the exception is defined).

There is also the trick to use "Obj.magic" for resizable arrays to
deallocate objects that are outside the index. I wouldn't know how else
to get the same behaviour.

Regards,
Markus Mottl

-- 
Markus Mottl                                             markus@oefai.at
Austrian Research Institute
for Artificial Intelligence                  http://www.oefai.at/~markus
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


  reply	other threads:[~2001-07-10 18:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-07-10 18:07 Berke Durak
2001-07-10 18:55 ` Markus Mottl [this message]
2001-07-11  6:44   ` Jean-Christophe Filliatre
2001-07-11  6:37 ` Jean-Christophe Filliatre
2001-07-11  7:29   ` Claude Marche
2001-07-11 18:03   ` Jerome Vouillon
2001-07-11 19:30 ` Xavier Leroy
2001-07-11 20:33   ` Markus Mottl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20010710205534.B29850@fichte.ai.univie.ac.at \
    --to=markus@mail4.ai.univie.ac.at \
    --cc=berke@altern.org \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).