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 nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id E9893BB81 for ; Mon, 28 Nov 2005 08:24:28 +0100 (CET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id jAS7OSC1023680 for ; Mon, 28 Nov 2005 08:24:28 +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 IAA08970 for ; Mon, 28 Nov 2005 08:24:27 +0100 (MET) Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.198]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id jAS7OQnN023674 for ; Mon, 28 Nov 2005 08:24:27 +0100 Received: by zproxy.gmail.com with SMTP id s1so2665314nze for ; Sun, 27 Nov 2005 23:24:26 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=S+wB06/yDhVUL9U5omw7fQUblhx9FPZGr1eSQy9dDW3Lf5jJTMP94hokkt6vDtFvKIlz3As/ZmZes5Z5mwnfSf38T+x+anpYsfSRE0lDvJprX6oJq6nZ6O/fa77vSH+jB+8ydRKUo8NY3ydP4BQtHwoCldxiRLGs3uks7sTU4S0= Received: by 10.65.237.13 with SMTP id o13mr6969130qbr; Sun, 27 Nov 2005 23:24:26 -0800 (PST) Received: by 10.65.241.4 with HTTP; Sun, 27 Nov 2005 23:24:26 -0800 (PST) Message-ID: <53c655920511272324w1630fe89y@mail.gmail.com> Date: Mon, 28 Nov 2005 08:24:26 +0100 From: David Baelde Reply-To: david.baelde@ens-lyon.org To: "Michael D. Adams" Subject: Re: [Caml-list] Efficency of varient types Cc: caml-list@inria.fr In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: X-Miltered: at nez-perce with ID 438AB0AC.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 438AB0AB.000 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 inference:01 translating:01 polymorphism:01 cheers:01 foresee:98 short:01 int:01 int:01 types: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=RCVD_BY_IP autolearn=disabled version=3.0.3 Hi, 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. My solution for your problem would be to write a simple type inference in order to check your scheme programs before translating. It's not so hard if you use tools like lambda-prolog for example. Of course you won't be able to translate untypable programs, but I think that's no problem. The only difficulty which I foresee is having polymorphism infered, at least it is not obvious to do with lambda-prolog, and you'll probably miss it. Cheers. -- David