4 ms·
Rust is nice, but… Why can't anybody made a language with the exact syntax of Python, but compiled? It doesn't need extreme safety features or other buzzwords.
by lcnmrn 11y ago
Rust is nice, but… Why can't anybody made a language with the exact syntax of Python, but compiled? It doesn't need extreme safety features or other buzzwords.
- SiVal 11y agoIt's ridiculous of them to downvote you instead of providing an honest answer. This is a good question that I think a lot of Python fans might wonder about. One of the many great things about Python (and other "dynamic" languages) is how flexible it is in so many ways. Instead of forcing you to be more explicit, make more decisions, and lock more things down in advance, it lets you get away with telling it to figure out a lot of things for itself while the program is running. This kind of flexibility isn't free. It does a lot of things indirectly, it makes decisions for you and, if they turn out to need changing, it makes those changes as, and so on, while it is running, which requires a lot of computation. You actually could compile Python, but keeping the "exact syntax" presumably means keeping all of Python's capabilities to be flexible at runtime, so compiling would require essentially building a lot of the Python interpreter right into your compiled app. This, in itself, would just change the packaging and wouldn't buy you much in terms of performance. A lot of clever people are looking for ways to speed up Python without removing features, but it will probably never be possible to make Python as fast as Rust will eventually be, nor to make Rust as convenient as Python.
- FreeFull 11y agoHave you looked at Nim, perhaps? I haven't used it, but at first glance it certainly seems more Pythonic than Rust.
- drewm1980 11y agoYou might be pleasantly surprised to learn that python by default caches the parsing results between runs. If it makes you feel better, you can think of it as ~partially compiled :) But there is an inherent trade-off between having a lot of flexibility at runtime, and having aggressive code specialization and optimization at compile time. Well, I suppose you could combine those into one language, but you couldn't do both on the same piece of code...
- Dewie3 11y agoBecause syntax isn't that big of a deal to most people, I guess. They are more concerned with actually useful things, like safety features and other buzzwords. ;) But like mentioned, there is Nim. Which at least have the indentation-thing going for it.