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 A4645BB81 for ; Fri, 24 Feb 2006 15:01:33 +0100 (CET) Received: from mail.physik.uni-muenchen.de (mail.physik.uni-muenchen.de [192.54.42.129]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id k1OE1WBq014503 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Fri, 24 Feb 2006 15:01:33 +0100 Received: from localhost (unknown [127.0.0.1]) by mail.physik.uni-muenchen.de (Postfix) with ESMTP id B33C82000D; Fri, 24 Feb 2006 15:01:32 +0100 (CET) Received: from mail.physik.uni-muenchen.de ([127.0.0.1]) by localhost (mail.physik.uni-muenchen.de [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 13787-01-47; Fri, 24 Feb 2006 15:01:32 +0100 (CET) Received: from mailhost.cip.physik.uni-muenchen.de (kaiser.cip.physik.uni-muenchen.de [141.84.136.1]) by mail.physik.uni-muenchen.de (Postfix) with ESMTP id 9A14920006; Fri, 24 Feb 2006 15:01:32 +0100 (CET) Received: from aso.cip.physik.uni-muenchen.de (eiger.cip.physik.uni-muenchen.de [141.84.136.54]) by mailhost.cip.physik.uni-muenchen.de (Postfix) with ESMTP id B1A0B26E87; Fri, 24 Feb 2006 15:01:31 +0100 (CET) Received: by aso.cip.physik.uni-muenchen.de (Postfix, from userid 3092) id 21C23C8671; Fri, 24 Feb 2006 15:01:32 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by aso.cip.physik.uni-muenchen.de (Postfix) with ESMTP id 13ECDD06B2; Fri, 24 Feb 2006 15:01:32 +0100 (CET) Date: Fri, 24 Feb 2006 15:01:31 +0100 (CET) From: Thomas Fischbacher To: Sebastian Egner Cc: caml-list@yquem.inria.fr Subject: Re: also for tagged records? [Was: Re: [Caml-list] (int * int) <> int*int ?] In-Reply-To: Message-ID: References: X-BOFH: Daemons did it MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: amavisd-new at physik.uni-muenchen.de X-Miltered: at concorde with ID 43FF11BD.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 ocaml:01 mutable:01 mutable:01 indirection:01 runtime:01 indirection:01 binary:01 in-memory:01 type-safe:01 cip:98 cip:98 lambda:01 lambda:01 wrote:01 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=SPF_FAIL autolearn=disabled version=3.0.3 On Fri, 24 Feb 2006, Sebastian Egner wrote: > This isn't valid Ocaml: > > type a = A of {mutable xA: int; mutable yA: int} > | B of xyB > and xyB = {mutable xB: int; mutable yB: int} > > Background: I had a case (a search tree data strucuture) where > the additional indirection results in a 30% runtime penalty, There now are quite a few cases where this "forced extra indirection" business becomes a nuisance. See for example the older discussion in the archives on implementing a binary heap properly on the basis of a variable-length array. The recommended solution is to use a Z option array, for some type Z. To a certain extent, this may be considered an issue of mandatory static type checking and the insistence on minimizing the tagging for in-memory representations. If static type checking were advisory, and more tag bits would be used internally, many of these problems could be solved. Besides, this would offer library implementors the freedom to use somewhat cleaner dirty tricks under the hood, while still providing a nice and tidy type-safe interface to the outside. -- regards, tf@cip.physik.uni-muenchen.de (o_ Thomas Fischbacher - http://www.cip.physik.uni-muenchen.de/~tf //\ (lambda (n) ((lambda (p q r) (p p q r)) (lambda (g x y) V_/_ (if (= x 0) y (g g (- x 1) (* x y)))) n 1)) (Debian GNU)