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
Weak pointers (summarize)
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 1997-03-19 (13:18)
From: Kohler Markus <kohlerm@b...>
Subject: Weak pointers (summarize)

I would like to summarize our discussion about weak pointers. 

1. There are some rare cases were weak pointers are usefull  to implement 
shared datastructures efficiently. This is probably even more important for 
distributed data structures where message sending can be  expensive. 
It  works on your example, because it doesn't matter if the weak pointer 
points to valid data or not.  

2. One have to be very carefully when using weak pointers. One example is 
extending our tree datastructure by an hash based access method. this would 
not work anymore with the weak pointer structure. 

3. There are other perhaps more clean solutions for that problem :
Since we know that every problem can be solved by an additional level of 
indirection, the following solution would be possible. 

		| | |
	Hashtable |

All pointers to nde a in the tree woudl have to point to a Proxy object, 
instead of pointing directly to object A. 

When all pointers to the Proxy object are gone it would go away and send a 
finalize message to A. A would then inform all it dependent objects "hey i'm 
going to be finalized". The dependent objects could then do the appropriate 

4. It would be really nice if pointers would be objects too. The solution in 3 
could the be implemented transparently.  

Any comments ?


| Markus Kohler                          Hewlett-Packard GmbH                |
| Software Engineer                      Network & System Management Division| 
|                                        IT/E Success Team                   |