Version française
Home     About     Download     Resources     Contact us    
Browse thread
RE: [Caml-list] Caml historical question
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Harrison, John R <johnh@i...>
Subject: RE: [Caml-list] Caml historical question
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