caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Markus Mottl <mottl@miss.wu-wien.ac.at>
To: Jacques Garrigue <garrigue@kurims.kyoto-u.ac.jp>
Cc: Judicael.Courant@lri.fr, caml-list@inria.fr
Subject: Re: [Caml-list] Implicit parameters (was Future of labels)
Date: Fri, 30 Mar 2001 09:55:27 +0200	[thread overview]
Message-ID: <20010330095527.A19834@miss.wu-wien.ac.at> (raw)
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

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


      reply	other threads:[~2001-03-30  7:55 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-03-29  0:44 [Caml-list] Future of labels Jacques Garrigue
     [not found] ` <AAEBJHFJOIPMMIILCEPBEEFHCHAA.mattias.waldau@abc.se>
2001-03-29  6:43   ` Jacques Garrigue
2001-03-29 11:44     ` Mattias Waldau
2001-03-29 17:52     ` Mattias Waldau
2001-03-29  8:22 ` Chris Hecker
2001-03-29  9:46 ` Markus Mottl
2001-04-09  1:28   ` John Max Skaller
2001-04-09  8:33     ` [Caml-list] Indexed and optional arguments (was Future of labels) Jacques Garrigue
2001-04-10 18:23       ` [Caml-list] " John Max Skaller
2001-04-09  8:45     ` [Caml-list] Future of labels Markus Mottl
2001-04-10 18:42       ` John Max Skaller
2001-04-10 22:01         ` Markus Mottl
2001-03-29 12:53 ` Judicael Courant
2001-03-30  3:42   ` [Caml-list] Implicit parameters (was Future of labels) Jacques Garrigue
2001-03-30  7:55     ` Markus Mottl [this message]

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=20010330095527.A19834@miss.wu-wien.ac.at \
    --to=mottl@miss.wu-wien.ac.at \
    --cc=Judicael.Courant@lri.fr \
    --cc=caml-list@inria.fr \
    --cc=garrigue@kurims.kyoto-u.ac.jp \
    /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).