Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Accumulating state
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2005-03-24 (16:21)
From: Jon Harrop <jon@f...>
Subject: Accumulating state

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 

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 

Dr Jon D Harrop, Flying Frog Consultancy Ltd.
Objective CAML for Scientists