Several weeks ago or more Ville made a comment that has been
resonating ever since.  In essence, his comment was that most "joined"
nodes already are the same node, so why not make all cloned/joined
nodes identical?

Imo, this is an important step forward.  I'll soon create a "one-node"
branch whose aim will be to make this the one and only way of
representing nodes in Leo.

At present, creating a clone creates a copy of a vnode, even with the
"unified_nodes" switch in effect.  You can see this in p.clone.  The
more I think about this, the "wronger" it seems.

In the new world, Leo would never copy nodes.  Instead, it would
simply create another pointer to the cloned node in the parent's
children array.  Thus, the same node could appear in several places in
the same child list.

This seemingly minor change would require significant changes in the
code that inserts and deletes trees.  For example, the present
_computeParentsOfChildren method would be rewritten or eliminated.
But that's good.

The "one node" world would, in fact, be equivalent, from a data point
of view, to a general graph world.  In particular, traversing the tree
becomes a bit tricky because *exactly* the same node can appear
arbitrarily many times in a traversal.

To handle this, a "generational" marking algorithm would be natural.
For example, to mark all nodes reachable from a given node, we
increment a generation count N, and "mark" a node v by setting v.mark
= N.  We can test whether a node v is marked by testing whether N >
v.mark.

These are fundamental, substantial changes.  However, my new-found
confidence in unit tests means I would feel comfortable in making such
changes.  It would probably be only a matter of a day or two's work.
It may happen this week in a branch.  It will happen early in the Leo
4.7 release cycle in the trunk.

Edward
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to