News for hackers. Stuff that matters.
Re:Tokio 1.0 – async runtime for Rust by jstrong on Friday January 01, 2021 @04:52AM (#25602085)
agree 100%. it honestly kind of baffles me, "async" is like the programming community's white whale, and all of us get to come along for the chase. meanwhile, I long ago grew accustomed to the paradigm of an "event loop" in my programs. after a certain point it becomes very natural. on the subject of memory, recently there was an issue where the async dyn futures were blowing up stacks because a resolved future was > 2mb - what!? I mean, look at the signatures in the aturon article - we are going from this

    fn read(&mut self, buf: &mut [u8]) -> Result<usize, io::Error>
... to this ...

    fn read<T: AsMut<[u8]>>(self, buf: T) ->
        impl Future<Item = (Self, T, usize), Error = (Self, T, io::Error)>
is that supposed to be easier?

I recently tried writing a small program that would manually poll a future to get a feel for it - utter disaster. conflicting versions of tokio, compiles but crashes because something is called outside of the tokio runtime context, etc. all the examples have #[tokio::main]-decorated main - it's like, I'm not giving you my #$(&#@(&ing main function! the programs I write have tons of stuff going on! I can't just give some library my entire control flow!

sorry for the rant! felt good to write it though.

There are no comments on this comment yet.