Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
optional static typing #104
Performance can be easily increased if the translator knew more about the type of each variable. And in the future, do better translation time type checking.
For example the
Python3 features function annotation syntax, however this only allows typing of arguments and the function return type. There is no syntax to type local variables inside a function. PythonJS is still only compatible with Python2.
C style typing syntax is very clear and readable, it can be implemented as a simple text pre-processor that transform the text without doing much heavy parsing. By hijacking multiple target assignment and making the typedef the first target, the translator can check for those special typedef names when looking at assignments.
The translator can easily support
The goal of this project is not to become a domain specific language. However, having it there as an option is a good thing, so long as typedpython.py can strip away the DSL and transform the source back to regular python, which is what it is doing now when running the regression tests against Python2 and Python3.