From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 88A7DBB81 for ; Mon, 28 Nov 2005 08:53:23 +0100 (CET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id jAS7rM4e016624 for ; Mon, 28 Nov 2005 08:53:23 +0100 Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id IAA08930 for ; Mon, 28 Nov 2005 08:53:22 +0100 (MET) Received: from will.iki.fi (will.iki.fi [217.169.64.20]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id jAS7rLRr026636 for ; Mon, 28 Nov 2005 08:53:22 +0100 Received: from acerf.exomi.com (fa-3-0-0.fw.exomi.com [217.169.64.99]) by will.iki.fi (Postfix) with ESMTP id 3CD2D79; Mon, 28 Nov 2005 09:53:19 +0200 (EET) Subject: Re: [Caml-list] Efficency of varient types From: Ville-Pertti Keinonen To: david.baelde@ens-lyon.org Cc: "Michael D. Adams" , caml-list@inria.fr In-Reply-To: <53c655920511272324w1630fe89y@mail.gmail.com> References: <53c655920511272324w1630fe89y@mail.gmail.com> Content-Type: text/plain Date: Mon, 28 Nov 2005 09:53:12 +0200 Message-Id: <1133164392.711.7.camel@acerf.exomi.com> Mime-Version: 1.0 X-Mailer: Evolution 2.4.1 FreeBSD GNOME Team Port Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 438AB772.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 438AB771.002 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 variants:01 variants:01 runtime:01 integers:01 ocaml:01 integers:01 wrote:01 polymorphic:01 short:01 int:01 int:01 variant:02 parameters:02 types:02 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 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.