Browse thread
Accumulating state
- Jon Harrop
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| 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 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