News for hackers. Stuff that matters.
Re:Write a mini-Redis in Rust: learn async programming with ... by sanxiyn on Tuesday August 04, 2020 @07:36PM (#24055672)
This is a fine tutorial, but I must note that Rust async programming is a bad way to learn about Rust, and also is a bad way to learn about async programming. You should learn the basics of both Ruts and async programming elsewhere, and then try Rust async programming.

If you disagree, take a look at compile error in https://tokio.rs/tokio/tutorial/streams and think again. That is in fact NOT atypical. (Amusing paradox: you get less errors once you learned, but you get the most terrible errors when you are the least equipped to deal with them.)

To slightly exaggerate, I spend about half my time in Rust support chat channel in my locality to discourage people from trying Rust async programming without getting the basics of Rust. Their logic go: I am interested in Rust only for async network programming, I am not interested in Rust sync network programming, I also learn best by try using something in a project straight away, so I will just learn Rust by writing a Rust async programming project! This literally 100% fails, but people who do this really really want to do it that way, and discouragement doesn't really work, and they get really frustrated, and... I am not sure how to solve this.

Re:Write a mini-Redis in Rust: learn async programming with ... by n_t on Wednesday August 05, 2020 @12:58AM (#24057395)
What are good resources to learn async concepts? Is there some resource which covers past and present across various languages? A resource which would conceptually cover - sync, async, blocking, non-blocking, threading, event loop/reactor, coroutines, futures/promises, async/await, fibres/green-threads, etc.
Re:Write a mini-Redis in Rust: learn async programming with ... by pjmlp on Wednesday August 05, 2020 @02:08AM (#24057742)
With my Windows/UWP and Android hat on, this only works when async is the only model available and the whole stack is designed for async programming, thus making it somehow easier do follow up on it.

This is actually the reason why those stacks don't offer sync APIs.

Re:Write a mini-Redis in Rust: learn async programming with ... by mamcx on Tuesday August 04, 2020 @09:47PM (#24056487)
I think async is for infraestructure writers of a very small selection of libs and servers (web server, db server, etc).

For the rest of us, is parallel and batch that is more useful imho, with at most, the ability to do something in the "background".

Re:Write a mini-Redis in Rust: learn async programming with ... by dpc_pw on Tuesday August 04, 2020 @07:48PM (#24055757)
Yeah. `async` involves a lot of sophisticated and bleeding edge machinery, and is not really "fully ready" for wide-consumption, IMO.

What's funny is that while `async` is great tool to have 99% of programs will not see a difference.

Re:Write a mini-Redis in Rust: learn async programming with ... by sanxiyn on Tuesday August 04, 2020 @08:10PM (#24055883)
I think wide consumption is getting there, but I don't think it will be ever ready for consumption by learners. There is just a lot under the hood.

(It pains me to write that because otherwise I am very much against Joel's law of leaky abstractions, I believe in aiming for leak-proof abstractions, and I know they are possible. It's just that it probably is not always possible, and it is especially hard to abstract learnability, and it is a lot of work even when it is possible.)

While I also think most people do not need async and will not see differences, I focus on learning aspect and refrain from saying "you probably don't need it", because I found people are not stupid and people who insist on async usually have actual need for async. This may be due to what kind of people congregate on my local community and may not hold elsewhere though.

Re:Write a mini-Redis in Rust: learn async programming with ... by gameswithgo on Tuesday August 04, 2020 @08:13PM (#24055900)
i haven’t had any issues with compile errors but holy moly when i forget to await something or block a thread...

if I didn’t know Rust decently already those problems would have broken me