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: Eric Cooper <ecc@c...>
Subject: Re: [Caml-list] (int * int) <> int*int ?
On Thu, Feb 23, 2006 at 06:28:48PM +0100, Frdric Gava wrote:
> is anybody can semantically explain why this 2 types are differents ?
> 
> # type t=A of int*int and  t'= B of (int*int);;
> type t = A of int * int
> and t' = B of (int * int)
> [...]
> I understand that it'is force you to have a pair for A and not just a value
> of type pair but why this restriction ? It is not easy to explain why
> int*int <> (int*int).

See section 18.3.4 of the manual -- the distinction allows the runtime
representation of t to avoid a level of indirection.  And since the
runtime representations are different, the types have to be different.

-- 
Eric Cooper             e c c @ c m u . e d u