News for hackers. Stuff that matters.
Re:Rust vs. Go in 2023 by satvikpendem on Sunday August 13, 2023 @04:29AM (#37107840)
Not really. I use unwrap and clone everywhere and I can do everything as if Rust were then a garbage collected language, and I can then test out different solutions, hack my way through, just as I would in Go or Python. Then once I have a good solution, even if I don't optimize it, it is leagues faster than Python and even faster than Go. If I do decide to optimize it, then, it's fast, really fast.

IMO those who say Rust isn't suitable for hacking seem to try to conform to best practices right away when really, dealing with lifetimes and excessive clones should be part of the optimization step, not the ideation and experimentation steps. Rust is as high level as you want it to be. Hell, I write web backends and sometimes even frontends in just Rust and I never worry about memory until I want to optimize, if I even want to optimize.

Re:Rust vs. Go in 2023 by hannofcart on Sunday August 13, 2023 @04:59AM (#37108014)
> Not really. I use unwrap and clone everywhere and I can do everything as if Rust were then a garbage collected language, and I can then test out different solutions, hack my way through, just as I would in Go or Python.

This part of the comment deserves to be highlighted and mentioned more. I think this exactly the way to "hack something together quickly" in rust.

After that, incorporating correctness seems to be as simple as grepping with each unwrap and "dealing with it".

With the above approach, Rust is a great prototyping language as well.

Re:Rust vs. Go in 2023 by bryanlarsen on Sunday August 13, 2023 @10:07AM (#37110168)
The thing about clone and to a lesser extent unwrap is that 90% of the time, just leaving in the clone is fine. It might be suboptimal, but if it's not in the main loop, who cares?

With unwrap, replacing the unwrap with an expect signals you've accepted that an unwrap is ok in that piece of code. I'd like a similar convention for clone.

Re:Rust vs. Go in 2023 by kaba0 on Sunday August 13, 2023 @10:29AM (#37110354)
If that’s the case, then Scala and similar should also enter the question. That is at least an expressive language compared to Go, and if you don’t need rust’s performance it may be a good tradeoff.