caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Xavier Leroy <xavier.leroy@inria.fr>
To: Brian Rogoff <bpr@bpr.best.vwh.net>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Caml historical question
Date: Tue, 15 Jan 2002 15:54:43 +0100	[thread overview]
Message-ID: <20020115155443.A10666@pauillac.inria.fr> (raw)
In-Reply-To: <Pine.BSF.4.40.0201101627580.2173-100000@bpr.best.vwh.net>; from bpr@bpr.best.vwh.net on Thu, Jan 10, 2002 at 04:40:20PM +0000

> OK Caml history buffs, I have a question which arose during my
> proofreading of a chapter of the forthcoming bestseller "Developing
> Applications with Objective Caml" (Stephen King, watch out!).
> 
> In the current translation, it is mentioned that "fun" is a legacy of
> older versions of Caml and it is insinuated that the "fun" form is somehow
> deprecated in favor of fun. What's the straight dope?

I wouldn't say that either "fun" or "function" is deprecated in favor
of the other.  Basically, we have "fun" for multiple-arguments,
one-case definitions:
        fun pat1 ... patN -> expr
and "function" for single-argument, multiple-case definitions:
        function pat1 -> expr1
               | ...
               | patN -> exprN
Both seem equally useful, although there is admittedly some overlap
between the two forms.

What is deprecated in OCaml, but was supported in Caml Light and Caml V3.1,
is multiple-case "fun":
        fun pat11 ... patN1 -> expr1
          | ...
          | pat1M ... patNM -> exprM
Although this form subsumes the previous two, the extra generality was
rarely useful, and complex patterns have to be parenthesized so that
the parser can figure them out.

- Xavier Leroy
-------------------
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


  reply	other threads:[~2002-01-15 14:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-01-10 16:40 Brian Rogoff
2002-01-15 14:54 ` Xavier Leroy [this message]
2002-01-15 17:08 Harrison, John R

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=20020115155443.A10666@pauillac.inria.fr \
    --to=xavier.leroy@inria.fr \
    --cc=bpr@bpr.best.vwh.net \
    --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).