This Engineering Notebook post discusses when to use Positions and when to 
use VNodes. The general rules:


1. Prefer VNodes to Positions if possible, but

2. Most outline operations *must* use Positions.


*Examples*


Outline commands such as insert-node, delete-node, and paste-node must use 
Positions because c.p affects what parent VNodes Leo must update.


When writing a .leo file, Leo must scan *all* nodes to find dirty @<file> 
nodes. Using *c.all_nodes*, an abbreviation for 
*c.hiddenRootNode.self_and_subtree*, will be *slightly* more efficient than 
*c.all_unique_positions*. But not enough to matter.


Otoh, *v.setAllAncestorAtFileNodesDirty* is the perfect place to use 
*v.self_and_all_parents*. There is no need to scan the entire outline!


Finally, Leo's outline-drawing code must use Positions because VNodes may 
appear in multiple places in the outline.


And that's it.


Edward

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/e558a13e-7f01-4104-81dc-40c098cc5330n%40googlegroups.com.

Reply via email to