English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

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: 2006-02-23 (18:33)
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 

We had this discussion earlier:


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)