English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
[Caml-list] Future of labels
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2001-03-30 (07:55)
From: Markus Mottl <mottl@m...>
Subject: Re: [Caml-list] Implicit parameters (was Future of labels)
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:


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