On Fri, 8 Dec 2017 04:37:01 -0800 (PST) "Edward K. Ream" <[email protected]> wrote:
> 3. The nodetags.py plugins caches vnodes. This is fine as long the > plugin (in effect) recreates the cache when the outline changes. Short version: in what way must the plugin "recreate" vnode data when the outline changes, assuming it's using c.vnode2position() when appropriate? Long version: My understanding, and it's worked for me so far ;-) is that you can "cache" (keep references to) vnodes without much worry - as long as you check the results of c.vnode2position() to make sure the vnode is still in the outline when you come to work on it. You could of course cache gnxs instead, with basically the same pattern. You certainly can't cache positions, seeing they become invalid very quickly. I only recently appreciated the coolness of weakrefs, as used in https://pythonhosted.org/blinker/ ... although I guess that wouldn't be as rigorous a check as c.vnode2position() - something else could be holding a regular reference. I don't know if there's a cheaper way to check that a vnode is still in an outline than c.vnode2position() - some ivar of the vnode that's always cleared when a vnode's removed from the outline. In practice even the check to see that the vnode is still in the outline is sometimes unnecessary, if the fact that your function was called on a particular vnode requires that it's still in the outline. Cheers -Terry -- 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/leo-editor. For more options, visit https://groups.google.com/d/optout.
