On Apr 6, 12:58 pm, "Edward K. Ream" <[email protected]> wrote:
Readers take note --> Feel free to skip this. It is mostly for the
hard core...
I might be the only person in the world foolish enough to try
this :-) For the last 15+ years I have explored a gazillion tree-
oriented algorithms. That's basically what a type checker is. Here is
one of today's insights/hacks:
We must expand the notion of identifier chain. Consider the following
valid Python statement:
a = b.c(2)[5:-1:8].d
Handling this in Pass1.attribute_to_string has proven to be tricky.
Such problems could be overcome, but there is a cute trick that
sidesteps the difficulties. We will represent the id chain on the LHS
as::
b.c()[].d
This means that when the type of b.c becomes known, the type of b.c()
depends *only* on the type returned from the function c, *not* on the
type of any
arguments. If this isn't true, type inference will surely fail. Time
for a lint_assert.
Similarly, when the type of b.c() becomes known, the type of b.c()[]
depends only on the the *single* type of *all* elements of the array
b.c()[]. Again, if this isn't true, type inference will surely fail.
Time for a lint_assert.
This a pretty good hack, if I do say so myself. It avoids the need to
parse Call and Subscript nodes and it elegantly generalizes the notion
of an id chain.
Another of my claims on this project is my focus on simplicity.
Pass1.attribute_to_string is the *only* place in Pass1 with detailed
knowledge of Ast trees. The contrast with pylint is stark. This is
something new in the new design. The old design was more complex.
Such simplicity does not come easily! The dirty bedclothes (I prefer
to call them notes in an engineering workbook :-) show the
difficulties involved in getting to simple.
Finally, I might be the only person in the world stubborn enough to
restart this project after last year's failure :-)
In short, nobody is going to talk me out of this project. I may
choose to abandon the project, but that's for me to decide.
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.