From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id UAA29594; Tue, 10 Jul 2001 20:55:41 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id UAA29590 for ; Tue, 10 Jul 2001 20:55:40 +0200 (MET DST) Received: from fichte.ai.univie.ac.at (fichte.ai.univie.ac.at [131.130.174.156]) by nez-perce.inria.fr (8.11.1/8.10.0) with ESMTP id f6AItcX29851 for ; Tue, 10 Jul 2001 20:55:38 +0200 (MET DST) Received: (from markus@localhost) by fichte.ai.univie.ac.at (8.9.3/8.9.3/Debian 8.9.3-21) id UAA30068; Tue, 10 Jul 2001 20:55:34 +0200 Date: Tue, 10 Jul 2001 20:55:34 +0200 From: Markus Mottl To: Berke Durak Cc: caml-list@inria.fr Subject: Re: [Caml-list] String.unescaped and some other little pitiful laments Message-ID: <20010710205534.B29850@fichte.ai.univie.ac.at> References: <20010710200734.B10265@localhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20010710200734.B10265@localhost.localdomain>; from berke@altern.org on Tue, Jul 10, 2001 at 20:07:34 +0200 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk 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