Browse thread
RE: Dichotomy between functions and type constructors?
- Don Syme
[
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: | Don Syme <dsyme@m...> |
| Subject: | RE: Dichotomy between functions and type constructors? |
I believe it's got something to do with cross module optimization. However, I've always wondered why the restriction is not lifted at least inside the module where the constructor is declared. Cheers, Don -----Original Message----- From: David McClain [mailto:dmcclain@azstarnet.com] Sent: 21 February 2000 17:09 To: caml-redistribution@pauillac.inria.fr Subject: Dichotomy between functions and type constructors? I am curious about the apparent dichotomy between normal functions and type constructors, and why this disparity exists? Say I have a type type thing = T1 of int * float | .... I can create such a type as T1(5, 3.14) but I cannot create such a type on a tuple result of a function call: let doit x = (x, float_of_int x) let myT1 = T1(doit x) This gives rise to a type checking error wherein the constructor T1 demands two arguments, instead of demanding a tuple of two elements. SML does not appear to impose this same requirement on the programmer, so what is the origin of the OCaml requirement? TIA, David McClain, Sr. Scientist Raytheon Systems Co. Tucson, AZ