Browse thread
syntax question
[
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: | Adam Granicz <granicz.adam@v...> |
| Subject: | Re: [Caml-list] syntax question |
Hi Michael, In the type definition > # type testme = Foo of int * int;; the constructor Foo takes *two* int arguments (thus, you can not construct a testme value supplying only one argument), whereas in > # type testme2 = Foo2 of (int * int);; it takes *one* tuple argument. Regards, Adam. On Fri, 30 May 2008 00:23:40 +0200, Michael Vanier <mvanier@cs.caltech.edu> wrote: > 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 > > > > > _______________________________________________ > Caml-list mailing list. Subscription management: > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list > Archives: http://caml.inria.fr > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs