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: Michael Vanier <mvanier@c...>
Subject: syntax question
Hi everyone,

I got bitten by a simple syntax problem:

# let a = (1, 2);;
val a : int * int = (1, 2)
# type testme = Foo of int * int;;
type testme = Foo of int * int
# Foo a;;
The constructor Foo expects 2 argument(s),
but is here applied to 1 argument(s)
# Foo (1, 2);;
- : testme = Foo (1, 2)
# type testme2 = Foo2 of (int * int);;
type testme2 = Foo2 of (int * int)
# Foo2 a;;
- : testme2 = Foo2 (1, 2)

Why does the compiler treat int * int and (int * int) in type definitions so differently?  Is it to 
give clearer error messages in the typical case?

Mike