News for hackers. Stuff that matters.
Re:Unreal Rust by nurettin on Sunday September 04, 2022 @11:54PM (#32720346)
I've been using C++ on and off since the 90s (borland C++ 5 times) Tried rust at initial release. Read a csv file line by line, split each line read (because I couldn't find any streams), converted to numbers and calculated some stats. Never again. What rust feels like: you are riding a bike, but it has six safety wheels instead of any normal wheels.
Re:Unreal Rust by jeffdn on Monday September 05, 2022 @12:17AM (#32720447)
I think it’s fair to say that Rust has changed massively since initial release. There are certainly safety aspects, but doing what you describe should be trivial and trigger none or almost none of them.

The compiler’s error messages are fantastically helpful these days. Might be worth a tinker some rainy day, but understand being completely turned off of something as well.

Re:Unreal Rust by nindalf on Monday September 05, 2022 @01:41AM (#32720940)
One major change since initial release was the introduction of a more permissive borrow checker. The newer one accepts many more valid programs thanks to the introduction of non-lexical lifetimes.
Re:Unreal Rust by ay on Monday September 05, 2022 @05:08AM (#32722073)
You can always use “unwrap()” in throwaway code.

https://play.rust-lang.org/?version=stable&mode=debug&editio...

If that code ever gets more use than that you expect, you can trivially find all the uses of “unwrap()”, and add the proper error handling. And yes there are quite a few places where things can go wrong.

But this explicit “signing for technical debt” when it relates to error handling is a really convenient productivity feature in practice.

A simple throwaway CLI for your own use is absolutely fine to use unwrap(), and you can fix it later on if it becomes a problem.

Re:Unreal Rust by xyzzy4747 on Monday September 05, 2022 @09:01AM (#32723826)
Unwrap is good to use for things that are expected to work 100% of the time. If unwrap fails in such situations, it’s fine to have the program panic and shut down.
Re:Unreal Rust by adrianN on Monday September 05, 2022 @12:46AM (#32720622)
I'm no Rust expert, but I believe reading a file line by line, splitting them, converting to numbers and doing something with them is just a handful of lines using methods on iterators. I suppose it was much harder in the initial release.