This continues an Engineering Notebook entry.  Feel free to ignore.

The string-oriented prototype is 100x faster than previous prototyping 
attempts. This makes a huge difference.

To repeat, this project will be worthwhile if it can find *even one bug* 
that pylint and pyflakes can't.  I'm closing in on success at breakneck 
speed.  Here is my present test string:

class TagController:

    def __init__(self, c):
        self.c = c
        c.theTagController = self
        
    def add_tag(self, p, tag):
        # Will fail if p is a vnode
        tags = set(p.v.u.get('__node_tags', set([])))
        
class LeoTagWidget(QtWidgets.QWidget):
    
    def __init__(self,c,parent=None):
        self.c = c
        self.tc = self.c.theTagController
        
    def add_tag(self, event=None):
        p = self.c.p
        self.tc.add_tag(p.v,tag) # WRONG: should be p.

And here is the output of the present prototype:

class TagController:

    def TagController.def __init__(self,c):

self.x= <TagController>.c=c
   c.x= c.theTagController=self

    def TagController.def add_tag(self,p,tag):

end_class ==== END OF CLASS TagController
end_class IVARS
{
  c:'self.c=c'
}
end_class METHODS
{
  __init__:'def __init__(self,c):',
   add_tag:'def add_tag(self,p,tag):'
}

class LeoTagWidget(QtWidgets.QWidget):

    def LeoTagWidget.def __init__(self,c,parent=None):

self.x= <LeoTagWidget>.c=c
self.x= <LeoTagWidget>.tc=<LeoTagWidget>.c.theTagController

    def LeoTagWidget.def add_tag(self,event=None):

   call <LeoTagWidget>.tc.add_tag(p.v,tag)

end_class ==== END OF CLASS LeoTagWidget
end_class IVARS
{
   c:'self.c=c',
  tc:'self.tc=self.c.theTagController'
}
end_class METHODS
{
  __init__:'def __init__(self,c,parent=None):',
   add_tag:'def add_tag(self,event=None):'
}

show C CLASSES
{
  theTagController:'c.theTagController=self'
}

As you can see, the prototype creates "symbol tables" for each class, plus 
a symbol table for 'c'. These are complete hacks, but they should be enough 
to find the bug.

A new, crucial,  "resolve" method will resolve chains like a.b.c to class 
(name). Resolve will work on strings, like everything else in this 
prototype.

A new design principle has emerged:  *check known chains and report unknown 
chains*. This will instantly give us a sense of how useful this tool might 
be.

I'll give myself a day or two to have the code find the bug.  If unforeseen 
problems arise I'll document them and (maybe) move on, putting this project 
(really) on the back burner.

Edward

P.S. *Important*: there are clear analogs between the string hacking of the 
prototype and corresponding (more complicated) ast-related code. So 
"cheats" in the prototype are perfectly admissible.

Building Leo-specific knowledge into the prototype does *not* mean that the 
tool will be Leo-specific. Later, we can build in generalized 
(non-Leo-specific) hints. But I won't even think of doing that until the 
prototype finds the first bug.

EKR

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