Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
syntax question
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2008-05-30 (07:03)
From: Christophe TROESTLER <Christophe.Troestler+ocaml@u...>
Subject: Re: [Caml-list] syntax question
On Thu, 29 May 2008 18:13:09 -0700, Michael Vanier wrote:
> I realize that this is how it works, but I don't understand why it
> should work this way. AFAIK elsewhere in ocaml "int * int" always
> refers to a tuple.  Similarly, if testme's Foo really took two int
> arguments I would expect to be able to create Foos as "Foo 1 2"
> instead of "Foo (1, 2)" which looks like Foo takes a single tuple
> argument, not two int arguments.  I don't see why "int * int" and
> "(int * int)" are different things.

Curried constructors are available in the revised syntax.  But since
the original syntax uses ``Foo (1, 2)'' for a constructor of 2
arguments, it is declared ``Foo of int * int'' by analogy with
products.  Hence the small glitch you noticed (in general that causes
no problems however).

My 0.02¤,