HACKER Q&A
📣 nothrowaways

Best way to refactor Rust to use Python syntax?


What is the best way to start if someone wants to change the syntax of rust programming language into python keeping its best features like speed?


  👤 whytevuhuni Accepted Answer ✓
I'd recommend taking inspiration from Nim, which uses some really clever metaprogramming techniques to allow for very terse representation of code.

Idiomatic Python is the way it is due to having really good defaults, but in order to achieve the speed of Rust, you often have to go against them. Metaprogramming allows for optimization of code by having a function examine another function, and changing the defaults in use to suit its particular use-case.

See also Mojo, which adds some C or Rust-like concepts to Python.


👤 nothrowaways
I like python syntax, writing rust in Python syntax could be a cool thing.