Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] Constructors as functions and tuples in constructors
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2003-10-08 (18:28)
From: Alain.Frisch@e...
Subject: Re: [Caml-list] Constructors as functions and tuples in constructors
On Wed, 8 Oct 2003, Andreas Rossberg wrote:

> That is not true. It would be quite trivial for the compiler to translate
>    A z -> e
> into the equivalent of
>    A(z1,z2) -> let z = (z1,z2) in e


   A _ as z -> e

would be enough (well, not for typechecking, of course) and avoid an extra
allocation. The idea is that any piece of code working on a pair (z1,z2)
can also work on A(z1,z2) since the runtime repsentation is the same,
except the tag which is not used.

-- Alain

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: