If when assigning an object you don't want it to be copied, ref are a natural 
fit. For example a resource like database connection or a network socket, when 
you pass those around you don't want to suddenly create a new one, so use ref 
for those. Note that you usually don't create those in a tight loop.

In some cases you have to use ref as well like for tree data structures or 
linked lists or for inheritance.

The important thing is understanding the tradeoff and making it a conscious 
choice. Well my view is probably skewed anyway as I mostly deal with plain old 
data, very low-level programming with high performance need.

Reply via email to