News for hackers. Stuff that matters.
Re:Leaving Rust gamedev after 3 years by treyd on Friday April 26, 2024 @09:33PM (#40176291)
If you were to write the same code without using async you'd be trudging through a mess of callbacks and combinators. This is what writing futures code before 2018 was like. It was doable if you needed the perf but it sucked. Async is a huge improvement to readability and reasoning that we didn't have before.
Re:Leaving Rust gamedev after 3 years by jeremyjh on Saturday April 27, 2024 @12:59AM (#40177387)
No, actually that was just javascript. Programming environments with threading models don't have to live that way. Separate threads can communicate through channels and do quite well for themselves. See how it works is, you do something like let data = file.read(); and the it just sits there on that line until the read is done and then your data has the actual bytes in it and you just use them and go on with your life.
Re:Leaving Rust gamedev after 3 years by eklavya on Saturday April 27, 2024 @05:25AM (#40178583)
Maybe you are both right but your scales are orders of magnitude apart.
Re:Leaving Rust gamedev after 3 years by zozbot234 on Saturday April 27, 2024 @06:43AM (#40178934)
> you do something like let data = file.read(); and the it just sits there on that line until the read is done and then your data has the actual bytes in it and you just use them and go on with your life.

That's exactly how async/await works, except that it translates to state machines under the hood which gives you great performance. No need to mess with threading models, at all.

Re:Leaving Rust gamedev after 3 years by vacuity on Saturday April 27, 2024 @12:30PM (#40181216)
Yeah, Rust's async/await and lightweight threads are functionally very similar. Function coloring is a problem with async/awaitt, though (for now?).
Re:Leaving Rust gamedev after 3 years by iudqnolq on Saturday April 27, 2024 @09:18AM (#40179741)
Until you need cancellation
Re:Leaving Rust gamedev after 3 years by ragall on Saturday April 27, 2024 @11:44AM (#40180825)
One rarely really needs that.