From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 747FFBC84 for ; Thu, 24 Mar 2005 17:21:04 +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 j2OGL4qE003461 for ; Thu, 24 Mar 2005 17:21:04 +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 RAA10087 for ; Thu, 24 Mar 2005 17:21:03 +0100 (MET) Received: from ptb-relay03.plus.net (ptb-relay03.plus.net [212.159.14.214]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j2OGL3B0025252 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 24 Mar 2005 17:21:03 +0100 Received: from [80.229.56.224] (helo=chetara) by ptb-relay03.plus.net with esmtp (Exim) id 1DEV4w-0005Hz-D4 for caml-list@inria.fr; Thu, 24 Mar 2005 16:21:02 +0000 From: Jon Harrop Organization: Flying Frog Consultancy Ltd. To: Ocaml Subject: Accumulating state Date: Thu, 24 Mar 2005 16:21:50 +0000 User-Agent: KMail/1.7.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200503241621.50618.jon@ffconsultancy.com> X-Miltered: at concorde with ID 4242E8F0.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 4242E8EF.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; vastly:01 incorrectly:01 incorrectly:01 minimise:01 minimise:01 ocaml:01 ...:98 frog:98 exception:01 graph:01 graph:01 imperative:01 motivation:01 caml:02 graphics:02 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.2 X-Spam-Level: I've just finished converting some library code from imperative to functional style. The code is used to represent a scene graph (for graphics). The motivation is that the use of a functional style vastly simplifies undo buffers, which can (almost) simply use persistence now. However, I'm finding that it is too easy to accumulate the scene graph incorrectly, creating external "references" (handles) for a version of the scene graph which is incorrectly forgotten about and then getting an exception when this handle is used with a scene graph that doesn't recognise it. What recommendations do people have on approaches to minimise this problem? At the moment, I'm just factoring my code to minimise the number of places which handle functional updates but I've got a feeling there's more that can be done... -- Dr Jon D Harrop, Flying Frog Consultancy Ltd. Objective CAML for Scientists http://www.ffconsultancy.com/products/ocaml_for_scientists