News for hackers. Stuff that matters.
Re:My Node.js is a bit Rusty by LudwigNagasena on Friday September 08, 2023 @08:26AM (#37432630)
Naive Rust code is super-awkward compared to naive JS code. I doubt one can do 1:1 port of anything more complex than Hello World (even FizzBuzz may get you tripped up).
Re:My Node.js is a bit Rusty by __s on Friday September 08, 2023 @08:34AM (#37432694)
Not sure what you mean by naive rust, but for Rust has good webassembly integration. To give you some context, here's a post I made about rewriting 10k lines of js into rust: https://www.reddit.com/r/rust/comments/k3jy5g/i_rewrote_10k_... (I went on to rewrite the server from nodejs to rust too)
Re:My Node.js is a bit Rusty by nicoburns on Friday September 08, 2023 @09:47AM (#37433437)
YMMV, but my Rust code ends up looking pretty much identical to my TypeScript code most of the time. And especially for code like this where there are no complex lifetimes.
Re:My Node.js is a bit Rusty by jplusequalt on Friday September 08, 2023 @10:53AM (#37434268)
I disagree. At my job I rewrote an environment variable injector module written in JavaScript into pure Rust. Not only was it straightforward, but I'm fairly certain I finished the Rust port faster than it would have taken to port it another language like Python or Go.