Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
From: Damien Doligez <damien.doligez@i...>
Subject: Re: [Caml-list] syntax question
On 2008-05-30, at 03:13, 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.

Almost, but not quite:

   # let int = 2;;
   val int : int = 2
   # int * int;;
   - : int = 4

Seriously, it's only an ergonomy problem in the syntax of type  
definitions.
Some better alternatives would be:

   type testme = Foo (int, int);;

or, if you like keyword-oriented syntax:

   type testme = Foo of int and int;;

But in any case, it's way too late to fix this problem now, so we have  
to
live with it, at least in the classic syntax.

-- Damien