caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* RE: [Caml-list] Caml historical question
@ 2002-01-15 17:08 Harrison, John R
  0 siblings, 0 replies; 3+ messages in thread
From: Harrison, John R @ 2002-01-15 17:08 UTC (permalink / raw)
  To: 'Xavier Leroy', Brian Rogoff; +Cc: caml-list

Hi Xavier,

| 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.

I used it quite a lot in CAML Light, and had to uglify my code to get
the same effect in OCaml. It seems to me that the extra generality does
no harm, and sometimes makes code a bit shorter and clearer.

I can understand the need for separate "fun" and "function" to deal with
ambiguities when multiple adjacent patterns are in a match. But I don't
see any reason at all to restrict "fun" to a single case. Surely there
are no substantial parsing subtleties here that don't arise anyway in
other cases? There are clear delimiters "|" and "->" around each
(multiple) pattern.

John.
-------------------
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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] Caml historical question
  2002-01-10 16:40 Brian Rogoff
@ 2002-01-15 14:54 ` Xavier Leroy
  0 siblings, 0 replies; 3+ messages in thread
From: Xavier Leroy @ 2002-01-15 14:54 UTC (permalink / raw)
  To: Brian Rogoff; +Cc: caml-list

> 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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Caml-list] Caml historical question
@ 2002-01-10 16:40 Brian Rogoff
  2002-01-15 14:54 ` Xavier Leroy
  0 siblings, 1 reply; 3+ messages in thread
From: Brian Rogoff @ 2002-01-10 16:40 UTC (permalink / raw)
  To: caml-list

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 note that in the hypermodern Revised syntax, which I happen to like, it
is actually "function" which is suppressed, and fun lives on.

-- Brian
-------------------
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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-01-15 18:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-01-15 17:08 [Caml-list] Caml historical question Harrison, John R
  -- strict thread matches above, loose matches on Subject: below --
2002-01-10 16:40 Brian Rogoff
2002-01-15 14:54 ` Xavier Leroy

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).