On Sun, Sep 6, 2009 at 1:16 PM, Edward K. Ream <[email protected]> wrote:
>
> This can't be correct, for several reasons.
>
Actually, I can be even more emphatic about this statement.
It is not immediately obvious from the code, but it is a fact nonetheless,
that Leo's present iterators are already highly optimized. A loop such as:
for p in c.allNodes_iter():
<< whatever >>
generates *exactly one* position p, and this position is "moved" by the
iterator using p.moveToX methods. This is a crucial space optimization. The
comment in the p.moveToX node says:
QQQ
These routines change self to a new position "in place".
That is, these methods must _never_ call p.copy().
QQQ
Furthermore, p.stack turns out to be essential in computing the next
position. To contemplate "optimized" vnode iterators is misguided: they
would have to simulate p.stack in order to work properly.
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
-~----------~----~----~----~------~----~------~--~---