Browse thread
(int * int) <> int*int ?
[
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: | Martin Jambon <martin_jambon@e...> |
| Subject: | Re: [Caml-list] (int * int) <> int*int ? |
On Thu, 23 Feb 2006, Eric Cooper wrote: > 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. See also how this issue is handled by the revised syntax: http://caml.inria.fr/pub/docs/manual-camlp4/manual007.html#toc24 Martin -- Martin Jambon, PhD http://martin.jambon.free.fr Visit http://wikiomics.org, the Bioinformatics Howto Wiki