5 ms·
The author doesn't really justify why he needed to port the python script to rust in the first place. Pulling down some JSON, doing a bit of transformation and
by djhworld 9y ago
The author doesn't really justify why he needed to port the python script to rust in the first place.
Pulling down some JSON, doing a bit of transformation and sending alerts seems like a perfect candidate for a high level language, I don't see any reason why you would port it to Rust unless you had significant performance concerns
- burntsushi 9y ago> The author doesn't really justify why he needed to port the python script to rust in the first place. And they don't need to. When I first learned Rust, I tried to write a `filter` function. Why would I ever do that? I could write `filter` much easier in Python, or heck, just use the `filter` method on iterators that is already in the standard library. I did it because I saw it as an opportunity to learn. I wanted to connect something I knew (`filter`) with something I didn't know (Rust).
- djhworld 9y agoI guess I was getting at the fact that porting the python script that does something very simple is the wrong tool for the job. A good candidate for trying to learn Rust is to find a script or tool that currently has the problems that Rust claims to fix.
- burntsushi 9y agoWhen someone comes to me and says, "I just spent the weekend porting a simple Python web crawler that was working just fine to Rust, and I came across problems x, y and z." What do you think an appropriate response is? Should we berate them for "choosing the wrong tool for the job"? Or should we ask them what they're problems were and help them fix them? I'm not saying we shouldn't have a conversation about which-tools-are-appropriate-when, but when someone is obviously trying to learn, let's put that on the back burner.
- omginternets 9y ago>I don't see any reason why you would port it to Rust unless you had significant performance concerns To learn Rust in a well-controlled environment? Isn't that the usual/sane way to learn a new language? Take something trivial you understand well from language A and port it to new language B? Note, of course, that this doesn't imply the result should be put into production.
- sidlls 9y agoBefore I convinced co-workers that we could use Rust in production (where we'd normally have used Python), I wrote a lot of this kind of script (where, I'd agree, a higher-level language like Python is a better choice) in Rust and Python so that they'd be able to have some idea of what the differences were and how Rust works. It seems like a great exercise for the very conservative or intimidated programmer to ease into more low-level programming.