Version française
Home     About     Download     Resources     Contact us    
Browse thread
Efficency of varient types
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Ville-Pertti Keinonen <will@e...>
Subject: Re: [Caml-list] Efficency of varient types
On Mon, 2005-11-28 at 08:24 +0100, David Baelde wrote:

> First, I'd like to point that you're talking about sum types and not
> variants. For short, variants are the backquoted labels `Int of int,
> and I think they cost more at runtime, for they cannot be encoded as
> integers.

Sum types are also known as variant types.  This terminology is even
used in the OCaml documentation.

What you're talking about are *polymorphic* variants, and they are in
fact encoded as integers, but they don't fit in the tag-portion of the
GC header so they take up more space than regular variants if they have
any parameters.