On Saturday, July 15, 2023 at 5:49:29 PM UTC-4 Edward K. Ream wrote:

My initial post in this thread showed how Leo could support Imps (Immutable 
Positions) without changing Leo's Position or VNode classes. I concluded 
that Imps were not a good idea :-)


Vitalije not-so-subtly implies that Positions are a blunder. This post 
refutes that notion.


*Positions are the foundation of Leo's generators.*


The great Bernhard Mulder proposed using generators such as 
*c.all_positions* and *p.self_and_subtree*. Much of Leo's scripting prowess 
is the direct result of generators.


It seems to me that one has to - or nearly has to - have something like 
positions.  Why? Because otherwise a node would need to know where it is in 
the tree, but nodes can be (and must be) duplicated or multiply referenced 
so that Leo can have clones.  Either the tree itself must know that or the 
outline must contain something that does.  That something can't be the 
VNodes themselves because clones.

If we think of a Leo tree as a container, then it can't be a container of 
VNodes.  So a tree must be a container of something else:  Hello, Positions!

This line of thought doesn't mandate any particular form for Positions or 
even that they be classes.  That's a design and implementation matter.

As for generators, I'm not wedded to them as generators;  they could be 
methods that return lists, and I suppose they were once upon a time.  
Probably having them as generators has a benefit I haven't discovered as 
yet (aside from possibly saving some memory, which may not be that much of 
an issue these days).  If we wanted to pass one of them around with its 
iteration partly executed, that would make a difference but I haven't seen 
a need to do that.

-- 
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/ce149633-d769-423b-9353-569133853717n%40googlegroups.com.

Reply via email to