Has anyone heard any mutterings of a translator from Python to Rust?
I have not done much Rust programming, and the most extensive was a translation from Python to Rust. It was a program that did lots of list manipulations and crunching data. But were I to really throw a lot of data at it, it would have been too slow. Looking at how my Python program was wasting time I concluded it was taking time because it was Python; I was only wasting time in the one place where I knew I have been inefficient.
My translation to Rust was designed to speed things up.
But in the process I also discovered a pair of complementary bugs that had been hidden in the Python code (unintended sharing of a list, that a second bug quietly depended upon).
I also discovered that the Rust version was line-by-line analogous to the Python. Side-by-side it looked like a demented Python. Seems to beg for an automated translation, at least for part of the work.
Python, by being so dang dynamic, is a great prototyping language: it doesn’t just defer types until its run time, it allows me to defer some of those decisions, too. But once the prototype is working, in most cases the types are not ranging all over the place, they are pretty well behaved. Just not specified. It would be nice to get some help rewriting it in Rust, to pin down those latent types, to get Rust’s speed and correctness.
It is possible that Python’s dynamic nature makes it really hard to even begin to pin down types. Okay, maybe involve the programmer: ask. It doesn’t have to be a turn-key solution to be useful, an interactive translator would be useful, too. Or maybe cython-like annotations…