Version française
Home     About     Download     Resources     Contact us    
Browse thread
Avoiding shared data
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Thomas Fischbacher <Thomas.Fischbacher@P...>
Subject: Re: Ant: Re: Ant: Re: Ant: Re: [Caml-list] Avoiding shared data

On Mon, 3 Oct 2005, Martin Chabr wrote:

> Avoiding shared data. Why is it done that way? Who
> wants to have an array or list of identical records or
> sub-arrays or other sub-structures which are all
> updated at the same time in the same way?

Thoughts about substructure updates and sharing structure do not mix.

There are situations where the one way to think about things is 
appropriate, and there are situations when it's the other one.

> In other
> words, who wants to have an array or a list of
> pointers which are pointing to the same thing?

Suppose I give you a tree representing the filesystem structure on my 
machine. Now I ask you to map this to the tree describing the filesystem 
with one directory renamed and another one (and everythinbg beneath it) 
deleted. You surely do not want to copy the entire tree, so this is an 
example where sharing structure perfectly makes sense. And as you do not 
destructively modify the data in the nodes, it does not matter at all for 
the semantics of the program that you actually share a lot of data.

-- 
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)