News for hackers. Stuff that matters.
Re:Unreal Rust by nu11ptr on Sunday September 04, 2022 @10:53PM (#32719993)
Have you written any Rust code by chance? I personally think Rust is easier than C++, possibly because it is a lot smaller language than C++ (at present). It isn't magic, but it kinda feels like it. To be able to do low level coding knowing you can't blow your foot off is pretty cool.
Re:Unreal Rust by pjmlp on Monday September 05, 2022 @02:10AM (#32721083)
I have, even if mostly hobby stuff.

Some stuff that places Rust going into the same kind of complexity as C++.

Figuring out how to turn DAG algorithms into tree based ones, two macro systems, async infrastructure, Pin and PhantomData special fields, GAT (when they arrive).

Lets see how it looks like with 40 years of production code, on the other hand C++ is indeed reaching PL/I levels of complexity for those that care about ISO legalese.

Re:Unreal Rust by nu11ptr on Monday September 05, 2022 @10:29AM (#32724692)
I guess it depends what kind of code you are writing. I've written all of the above w/o too much trouble, but yes, those are the harder parts. However, most of my code is just basic logic, so has very little interaction with that stuff (with exception of async, which I use every day). My C++ is more rusty (pun not intended), but I'm sure there are powerful features that you might use occasionally, but generally don't use much. My point is that day to day coding in Rust is very easy and pleasant, and every once in a while needing an advanced feature that you have to lookup doesn't necessarily make the common case challenging. Like any language, it is hard to tell all this without writing a large project in it.
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.