From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: * X-Spam-Status: No, score=1.4 required=5.0 tests=AWL,DNS_FROM_RFC_ABUSE, SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id 502EFBC68 for ; Tue, 26 Sep 2006 05:29:29 +0200 (CEST) Received: from py-out-1112.google.com (py-out-1112.google.com [64.233.166.178]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id k8Q3TSBq009335 for ; Tue, 26 Sep 2006 05:29:28 +0200 Received: by py-out-1112.google.com with SMTP id f25so2636775pyf for ; Mon, 25 Sep 2006 20:29:26 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=e4LR7RYM1H39VN4AWoVgxR1q9l6cypymoIJEQHJTVPBrSqpDkkT5dms+4ByPPu06WU4TochtXLC1HMBnoxBlopr3iZZ0+HvPzkxEfmL1wKu7dLdEjTtq2D7vIYGPbBLOk9NmHFiQb7Bw+aVF2DFqzB0xGsSXMPTt9aQwdf+5gV8= Received: by 10.35.39.13 with SMTP id r13mr524677pyj; Mon, 25 Sep 2006 20:29:26 -0700 (PDT) Received: by 10.35.76.7 with HTTP; Mon, 25 Sep 2006 20:29:25 -0700 (PDT) Message-ID: <53c655920609252029h770cbd2s79561eedd4e711d6@mail.gmail.com> Date: Tue, 26 Sep 2006 05:29:25 +0200 From: "David Baelde" Reply-To: david.baelde@ens-lyon.org To: Ocaml Subject: Attributes for free MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline X-j-chkmail-Score: MSGID : 45189E98.001 on discorde : j-chkmail score : X : 0/20 1 X-Miltered: at discorde with ID 45189E98.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; computations:01 abstracted:01 parsing:01 computations:01 datatype:01 non-trivial:01 hash:01 hashtables:01 typing:01 slower:01 naming:01 referenced:01 modules:02 variables:02 hints:02 Hi, I have a lambda-term representation, which is used in intensive computations. I'd like to attach some attributes to some of these terms, like naming hints for abstracted variables, parsing or typing information. This information wouldn't be accessed very often, typically not in my intensive computations. I could of course extend my datatype to do that. But (1) it takes a non-trivial modification of the code in several of my modules (2) making the term representation heavier might make my computations slower. Thus, I'm looking for an other solution. I could use some hash table. The problem is that it doesn't play well with GC: if I release some term, the GC might not be able to erase it if it's referenced in the table, and it won't be able to erase the associated attributes either. Any idea ? I don't know much about weak hashtables, I especially have no idea about the erasing strategy. Could it help ? Thanks for any advice. -- David