Yesterday I made an instructive mistake. In PR #3473 
<https://github.com/leo-editor/leo-editor/pull/3473>, I attempted to fix a 
hang in Leo's paste-node command using alt generators. Instead, I should 
have looked for the actual cause of the hang.


*c.recompute_all_parents* must use a VNode-based generator because the 
v.parents arrays are invalid. As a result, Position-based generators won't 
work. But this situation is uncommon!


Rather than relying on alt generators, it's preferable to restore the 
integrity of Leo's data as soon as possible!


For example, the new paste-node code hangs because the command tries to 
compute the position of the to-be-pasted node *after *c.unarchive_to_vnode 
invalidates Leo's data. Doh! paste-node should do this *before *calling 
c.unarchive_to_vnode.


After several hours of aimless flailing I trashed all my work with `git 
checkout .`


*Summary*


VNode base (alt) generators are worth having, but they are not cure-alls. 
Alt generators are essential only in a few limited situations. Otherwise 
they are, at best, minor optimizations. They are no cure for logic bugs.


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/aa5ff2c6-bf8e-4ef7-8206-3355ed5beb54n%40googlegroups.com.

Reply via email to