This is an announcement for a new Python back end of PureScript.
TL;DR: just reading the bold text in following paragraphs.
CodeGen.JS and writing my own code emitter.
I’m one who learned a lot programming languages, and also created a lot. Also I’m a student who is studying under the supervision of some of the best researchers in the field of Programming Languages. Python is special to me, partly due to it’s the first language I digged deep in, however as time goes by, I do feel writing Python more and more disturbing.
I tried many approaches, Mypy, PyCharm, making statically typed programming languages, making Python code generators from functional programming languages like Idris. All of these workarounds have unsolvable problems, and I suffered a lot since these year. For instance,
- Mypy: not strong enough, not higher kinded types, cannot use monad, verbose annotations…
- PyCharm: even weaker than Mypy, just better when it comes to real time checking.
- Making programming languages: type inference for Higher Rank Types turns out to be really horrible to me and I think it too difficult ot maintain a language by myself(seems no one in Python community cares about these problems).
- Idris/Agda code generator: in lack of source code positions(hence I cannot redirect runtime errors to the original source code), and the restricted FFI is annoying though might be safer.
In terms of better languages like Haskell, they usually cannot provide a codegen backend interface.
I did suffer a lot, I did. However! However I finally got PureScript. This is not the first time I tried PureScript, 2 years ago I did but at that time I’m in my honeymoon with Haskell(now its horrible IDE support is dismissing me…)
PureScript solved all above problems in my previous workarounds had! And purescript has row polymorphisms, which is one of my favorite language features!
Since that I think PureScript shall be the answer! This feeling got stronger and stronger when I was enjoying PureScript IDE support in VSCode.
Then I feel responsible for making an actively maintained and highly available Python back end for PureScript.
I’d say I’m expert in Python, as I’m one of the very rare guys who totally understand Python execution models, and compiler internal stuffs such as mechanisms of runtime error reporting, and bytecode instructions. All of these does help to develop a good PureScript Python, for instance, I can redirect the runtime error to purescript source code, instead of the generated Python code.
So this is the reason why I think I’m suitable for making this work: I’m a PL researcher, a CPython expert, a previous Haskeller, and one who’s not satisfied with workarounds. I then started PureScript Python and after shorter than one week, I made it.
There’re some progress, for instance, in purescript-python, now we can specify foreign implementation files in separate directories. I also have some ideas for distributions of multiple backends, and feel like to discuss if anyone has interests.
Besides, I’m looking for contributors and collaborators, such as who’re familiar with PureScript ecosystem, who use Python and who feel painful about Python.
Finally, I appreciate this community, and I appreciate developers of the PureScript compiler, if you visit Japan around Tokyo in the future, please let me know and I’d entertain you have a meal.
Your compiler developers’ design of PureScript’s alternative backends, is virtually a kind of art.