Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
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

Maybe:

   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 caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners