Yesterday morning, and again last night, the solutions to several long- standing questions became apparent. The solutions are simple and unforgettable.
The train of thought that lead to the Ahas has something to do with a "chance" remark made by somebody recently, I don't know who or in what thread, about clones without children being related to different views of the outline. I may have mangled the sentiment completely. If you know what I'm talking about, please point me at the remark. ===== The problems For at least 5 years, and probably longer, people have wanted differing views of nodes: 1. The sea of nodes. The great LeoUser (the progenitor of Leo's minibuffer) had a dream of nodes being "free form", that is, not constrained by outline structure. It's a tantalizing vision... 2. Half clones. A frequently requested feature is some kind of clone- like operation that would *not* clone a node's children. The obvious solution to both of these problems would seem to involve eliminating structure links, but... ===== The Aha Suppose we ignored Leo's structure links. We would immediately need *another* set of links in order to organize the sea of nodes, or to organize the half clones. So the Aha is: The sea of nodes, and half clones, require *additional* links The idea that we can *eliminate* structure information leads us in exactly the wrong direction. You can think of each kind of structure as different colored links. Each color induces a different view of nodes. We could have a sea-of- nodes view, a per-person view, a general-graph view, etc. Each view might have a different *rendering engine*. Each view has its own rules! The rules for each view (and thus each rendering engine and each set of links) are completely independent! Leo's traditional outline view prohibits nodes from being ancestors of themselves. But that rule would not exist in either a general graph view or a sea-of-nodes view. Back links might be shown in such views without the slightest problem. ===== Implementation At present, all link information resides in vnodes, specifically the parents and children arrays. The rendering information is the information not written to the file. Everything else is the "real" content of the vnode. This content, and *only* this content, is independent of view and rendering engine. It is easy to implement multiple links! We simply add a single dict to each vnode, say v.viewDict. Keys are view keys, values are parents and children arrays for that view. Switching (global) views simply involves switching the global view key. Leo's fundamental code in leoNodes.py will simply access v.viewDict.get(view).parents and v.viewDict.get(view).children instead of v.parents and v.children. Python's properties make this "indirection" transparent to most of the code in leoNodes.py! We can implement multiple links in less than a page of code. ===== Conclusions and questions It's too soon to tell what practical impact these Ahas will have. They might form the basis of Leo 5.0. They may suggest other new directions. Surely, though, this is a fundamental breakthrough. Questions remains about half clones. Could we show different colored links within the same outline? The obvious way to do this would be to show "my-view" links in @view my-view trees. Would this be useful, or just confusing? It's too early to tell. Things are clearer, I think, for scripts. Scripts will have no trouble dealing with links of a different color. For example, Leo's rst3 command could have an option to specify which *kinds* of structure to use in organizing documentation. This is the general answer to Kent's desire to organize documentation freely. Each way of organizing documentation induces a different color of links. The content stays the same, but the organization can vary freely. Actually, scripts could even vary the *content* by munging the content based on the view-selector. This would be easy to do using tags in the text, a topic of another post... Finally, the picture that emerges is a *general graph of views*. Think of the general graph as a set of overlays. Each overlays shows the links of a particular color. Each overlay is a *distinct* view, with its own rules for links. Yes, there is a general graph in the background: the union of all links of all colors. But this "joined" view is much less interesting than the individual views! Each individual view has its *own* identity and its *own* structure and is *own* rules. For example, a DAG doesn't become a general graph merely because it is part of the a larger union. In short, this Aha creates a new kind of data structure: a merger of *independent* components. Edward P.S. I had some other Ahas yesterday, but they will have to wait for another post... EKR -- 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.
