caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Pierre Weis <Pierre.Weis@inria.fr>
To: Damien.Doligez@inria.fr (Damien Doligez)
Cc: caml-list@inria.fr
Subject: Re: unwind-protect?
Date: Tue, 21 Nov 2000 10:36:38 +0100 (MET)	[thread overview]
Message-ID: <200011210936.KAA02218@pauillac.inria.fr> (raw)
In-Reply-To: <200011171401.PAA0000024608@beaune.inria.fr> from Damien Doligez at "Nov 17, 100 03:01:34 pm"

> >From: Pierre Weis <Pierre.Weis@inria.fr>
> 
> >Here, polymorphism, curryfication, and specialization are shining,
> >since you juste have to add one in_* functional application before an
> >actual call to any function f to obtain a specialized evaluation
> >context for f. For instance:
> 
> >let in_tmp f arg = in_directory "/tmp" f arg;;
> 
> Actually, currying gets in the way in this case (as it often does).
> If f takes two arguments, then "in_tmp f x y" will not work as
> expected, but the type-checker will not find the error.
> 
> -- Damien

Right, you have to know that this in_* functions protect the last
application of a function. Hence to apply a curried function you need
parens to partially apply the function, as in_tmp (f x y) z.

Alternatively, you can define your n-ary functions as having tupled
arguments and write in_tmp f (x, y, z) (then the typechecker will find
the ``arity'' errors).

If you had functions with specific arity built-in in the langage, you
would have to define multiple versions of the protect functions, one
for each arity, which is not so appealing...

Pierre Weis

INRIA, Projet Cristal, Pierre.Weis@inria.fr, http://cristal.inria.fr/~weis/




  reply	other threads:[~2000-11-21  9:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-11-17 14:01 unwind-protect? Damien Doligez
2000-11-21  9:36 ` Pierre Weis [this message]
  -- strict thread matches above, loose matches on Subject: below --
2000-11-17 14:37 unwind-protect? David McClain
2000-11-17  6:23 unwind-protect? Colin Walters
2000-11-17 12:28 ` unwind-protect? Pierre Weis
2000-11-17 13:54   ` unwind-protect? CREGUT Pierre FTRD/DTL/LAN

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=200011210936.KAA02218@pauillac.inria.fr \
    --to=pierre.weis@inria.fr \
    --cc=Damien.Doligez@inria.fr \
    --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).