In contrast to the dreaded disagreement, I have benefited greatly from Ville's doubts about the so-called super-lint project. It has spurred me on.
I am now 95% (really 100%) convinced that something very cool is possible: safe, automatic generation of Cython code from unmodified (or very lightly modified) Python sources. Ville is correct: type inference is a solved problem. And it *can* be solved in a Python context. For sure, we can understand the types of *some" Python variables at "compile" time. The only question is, how many (what proportion)? There are at least two ways of resolving more and more symbols: 1. An iterative algorithm, that continues until no more types can be deduced, or 2. Hints about types. The point is that super lint can *check the hints*, so the hints merely reduce (perhaps significantly) the time it takes to deduce types. Details omitted, but it turns out that thinking about where hints are most needed sheds a lot of light on the general, iterative, algorithm. In this context, performance *doesn't matter* (although it will be fast enough), and it *also* doesn't matter what proportion of types eventually get known: Cython can handle "general" Python objects of unknown type. Thus, my assertion that it is 100% possible to generate cython code from any Python code could be called trivial: Proof: Cython is a superset of Python, thus any Python program is *already* a Cython program :-) More helpfully, it should be (is) possible to design a type-checking algorithm such that hints *merely* speed up the algorithm: hints eventually get checked anyway so that they are in no way dangerous. The take-away message is this: a pragmatic approach to static type checking has exposed a beautiful sweet spot. I am convinced that useful, automatic conversion of Python programs, including Leo, can, be done in time roughly linear in the size of the source code. Indeed, the algorithms are straightforward adaptations of algorithms used in almost all compilers. 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.
