Version française
Home     About     Download     Resources     Contact us    
Browse thread
(int * int) <> int*int ?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Thomas Fischbacher <Thomas.Fischbacher@P...>
Subject: Re: [Caml-list] (int * int) <> int*int ?

> is anybody can semantically explain why this 2 types are differents ?

They are implemented in a different way internally. This is one of the 
dark corners of OCaml. 

(To my understanding, a constructor can carry multiple arguments, but 
depending on whether you put the parens or not, the tuple will be folded 
into a multi-slot constructor, or the constructor will have a single slot, 
which is a tuple.)

And yes, this *can* give you major headache if you first discover it when 
you try to raise a complex exception with sub-structure from within C 
code.

We had this discussion earlier:

http://groups.google.com/group/fa.caml/msg/86fb0679c8d11b1b?hl=en

-- 
regards,               tf@cip.physik.uni-muenchen.de              (o_
 Thomas Fischbacher -  http://www.cip.physik.uni-muenchen.de/~tf  //\
(lambda (n) ((lambda (p q r) (p p q r)) (lambda (g x y)           V_/_
(if (= x 0) y (g g (- x 1) (* x y)))) n 1))                  (Debian GNU)