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 JAA25331; Fri, 30 Mar 2001 09:55:35 +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 JAA25404 for ; Fri, 30 Mar 2001 09:55:34 +0200 (MET DST) Received: from miss.wu-wien.ac.at (miss.wu-wien.ac.at [137.208.107.17]) by nez-perce.inria.fr (8.11.1/8.10.0) with ESMTP id f2U7tX911757 for ; Fri, 30 Mar 2001 09:55:34 +0200 (MET DST) Received: (from mottl@localhost) by miss.wu-wien.ac.at (8.9.0/8.9.0) id JAA21191; Fri, 30 Mar 2001 09:55:27 +0200 (MET DST) Date: Fri, 30 Mar 2001 09:55:27 +0200 From: Markus Mottl To: Jacques Garrigue Cc: Judicael.Courant@lri.fr, caml-list@inria.fr Subject: Re: [Caml-list] Implicit parameters (was Future of labels) Message-ID: <20010330095527.A19834@miss.wu-wien.ac.at> References: <20010329094438J.garrigue@kurims.kyoto-u.ac.jp> <3AC33042.94F387B@lri.fr> <20010330124237D.garrigue@kurims.kyoto-u.ac.jp> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20010330124237D.garrigue@kurims.kyoto-u.ac.jp>; from garrigue@kurims.kyoto-u.ac.jp on Fri, Mar 30, 2001 at 12:42:37 +0900 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Fri, 30 Mar 2001, Jacques Garrigue wrote: > You can easily do dynamic scoping in ML (contrary to Haskell), by > using references. The only pitfall is that the produced code is not > reentrant. Another solution to this problem is to use a state monad that passes around the parameter implicitly. This would also keep the code purely functional (= reentrant). The only problem here is that using monads in their general form with OCaml is usually more cumbersome than with Haskell due to the lack of overloading. It's also a quite bit slower than passing around the parameter explicitly. For those who want to see an example of the use of state monads and to compare with a solution that passes around the state parameter explicitly, you can take a look at the following: http://www.oefai.at/~markus/ocaml_sources/IMP-1.0-3.tar.gz Regards, Markus Mottl -- Markus Mottl, mottl@miss.wu-wien.ac.at, http://miss.wu-wien.ac.at/~mottl ------------------- To unsubscribe, mail caml-list-request@inria.fr. Archives: http://caml.inria.fr