On Fri, 15 Mar 2002, Andre Poenitz wrote: > Making everything into a object variable is like making it 'locally > global'. Suddenly much more functions (namely the other member functions of > the class) gain access to data that should be available to only to one > of them.
This is not what we are proposing. We are proposing to use a back-linked data-structure rather than a single linked data-structure, where information only can flow from the top to the bottom. Compare with the difference between a single and double linked list. Yes, you can do the same things with either. However, some things are much simpler when you have the back-links. It is simply useful in many cases to be able to get in contact with your parent, without having to impose this into every method in the program. Maybe the set of operations that need to have this back-link in the parameters is limited. However, such a structure *will* stiffle change: The day that you discover that the foo-method could really use a back-link, you discover that you have to change this in many files, and then you resort to hacks instead. Also, by reversing the links from back-links to forward-links that provide what exactly what the current child needs, you run into a different problem: What if the child would like to have access to a parent Paragraph, rather than the parent Buffer? Then you have to add another parameter, or even worse, wrap everything up into a struct, and then pass this around. Or maybe we need access to the sibling, because it affects the layout? When you do not have backlinks, you have to push the responsiblity of providing the children with their needed information into the parents. Basically, you are only shuffling things around, and the result is an un-balanced program: The leaves are dead-easy, because they have everything served on a silver-plate. However, the parents have a hard time, because they have to serve many different kinds of leaves, each with it's own set of wishes. The better solution is to give the insets the option to access the information they need by themself. Notice that the insets have only structured access: They have to obey the chain of command. It's not like everything is suddenly global. I see no good reason to impose a barrier in this data-structure to make it one-way only street. Greets, Asger