Browse thread
[Caml-list] Overlapping features of variant types and tuples in Ocaml
- Vesa Karvonen
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Vesa Karvonen <vesa_karvonen@h...> |
| Subject: | [Caml-list] Overlapping features of variant types and tuples in Ocaml |
Consider the following code:
type variant =
| Tuple of (int * int)
| Non_tuple of int * int
let contents variant =
match variant with
| Tuple x ->
x
| Non_tuple x ->
x
As you can tell, the above code does not compile with Ocaml 3.04:
The constructor Non_tuple expects 2 argument(s),
but is here applied to 1 argument(s)
Is there a good reason for this behaviour or would it be purely
beneficial to remove the special handling of type lists in variants?
_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners