On Tuesday, May 1, 2018 at 8:40:00 PM UTC-5, Edward K. Ream wrote:

​I am dubious about this whole approach, for the following reasons:
>

A few more comments, since they prevent me from sleeping.

1. A crucial architectural principle is the following:

    *Modules and classes are responsible for their own messes*.

It's unacceptable for a class to "export" its problems to other classes.

At present, the gnxDict is used by four classes, especially the 
FileCommands and AtFile classes.  This may not be ideal, but it's not 
reason enough to change the existing code.  The present code works and the 
complexities are confined.

2. I shall reject any proposed change to either the Position or the VNode 
class.  It's time to move on.

3. Imo, static methods are an indication of dubious class design. There 
aren't any in Leo.

4. In my previous reply I mentioned passing a DummyCommands instance as the 
"context" arg to the VNode ctor. 

Several more comments:

A positionless vnode could probably be instantiated by passing None as the 
"context" arg.  Indeed, the context arg is used *only *to access two 
commander methods, and to gain access to c.hiddenRootNode.

If (don't ask me why) we want to define iterators over vnodes *without* 
using a full Commands instance, we could define a DummyCommands instance as 
follows (completely untested):

class DummyCommands:
    def __init__(self):
        self.hiddenRootNode = v = VNode(context=self)
        v.h = "<hidden root vnode>"

In other words, positions *only *have to know about 
p.v.context.hiddenRootNode.  And clearly, positions *must* know about the 
root of the vnode tree. There is no point in pretending otherwise.

Btw, my idea of using g.NullObject as v.context can't possibly work.

*Summary*

Modules and classes are responsible for their own messes. Several classes 
use fc.gnxDict, but the actual ugly code is confined to the FileCommands 
class itself.

I shall reject any proposed change to either the Position or the VNode 
class.  It's time to move on.

The DummyCommands class given above would likely allow the Position class 
to traverse a tree of vnodes without instantiating a full commander 
(Commands instance).  Imo, this isn't likely ever to be useful, but who 
knows...

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 [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.

Reply via email to