Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
donkulator3117142dWell if nothing else it will give some insight into how much complexity async/await introduces behind the scenes.
-
typosaurus12232141dAre you only 'learning' from AI. It's like someone playing music, you won't learn from that. Rust has a big tutorial. Maybe do it from beginning to end or share some code here. I think Rust is not an easy language in general. The shit it does just to avoid malloc, it's too much.
Rebuilding async can be a lot of fun tho. But are you sure async is the way? In most cases not async is way to go and faster. Async is a small overhead too.
Edit: tsoding made his own async but it's in C. But I think you can learn from it -
jestdotty5737141dI keep being really mad at that "no boilerplate" guy on YouTube
he made a lot of claims about rust and they were all wrong, I get to find out every day. stupid British voice
like one of them was that once you write a crate it will be "done".
so now I'm looking at reqwest. it's clear it wasn't done. but the devs sure left and abandoned it like it was.
also async is a mess in rust. evidently I'm not the only one who thought this, found a blog by a dude going into detail about it
maybe rust as a general is ghost town -
typosaurus12232141d@jestdotty Async is just starting a thread and decide yourself when to collect result right?
Tasks = [task1(), task2(), task3()]
All_res = wait_for_all_tasks(Tasks)
But because initialization of a thread is slow, it works with a thread pool of already initiating threads. That's why async engine is started first -
pythonPlusPlus569141dWithout really knowing what specifically you are doing or having implemented it myself, isn't async at its core "just" an event loop/queue of tasks?
Code runs in a single thread. Depending on the async part, like timers, web requests or file writes, they either use an async API themselves or run in a separate thread/process. Once they are done, their result is pushed to the queue. Once the main thread finishes a task or hits an await, the next queue item runs.
That's just my understanding though, idk if it's right or useful. -
Lensflare17551141dOne key insight helped me to understand async/await better: Async has nothing to do with threads.
This is a frequent misconception, it seems. -
donkulator3117141d@jestdotty I've just had a look at that channel, to see which specific British accent could be so bad that a Canadian would think it sounds stupid.
Disappointingly, I think you're right. -
typosaurus12232141d@jestdotty did you check libuv-rs? It's a wrapper around the C libuv lib and used in node and it claims to be used by rust. Don't know if they mean as core or package. Would be funny if rust steals the performance stuff from C. Is rust a myth?
-
typosaurus12232141dI had huge discussion with someone that controls the news about how async works.
So i decided to try uvlib. Damn, the docs. So pretty, but so useless. There's is an example of an echo server and not from a client. So i ack trough the whole docs with example code, nothing. In the end i found some at the unit test. Then, i decided to make the client / server in the same file and run at once. Async, right? No, it gave a lot of issues like client sending data too soon. I use default_event_loop(). Maybe different one would've given different results.
But so far, i don't think it's hard to make. I need some more research, but it really seems like executing a list of functions. Those functions tell themselves if they're ended. Those functions get executed SYNC.
Thanks for listening to my tedtalk -
typosaurus12232141dOh, and server uses 100% cpu on code i've not written. I just call the server function async. After that, my source get's executed once and never again. It hangs on the server code now. It's now me
-
jestdotty5737141d@retoor I kind of don't want wrappers
technically I could just rewrite everything in JavaScript and be done with it
I think it's cheap to pull in code from another language
for some reason I decided to re-invent async myself ground up for no reason even though I've last month taken up the philosophy "as long as it works, make it as janky as possible" which was actually very invigorating and fruitful in the end
but now I feel overwhelmed, there's no resources, I've never done anything similar, nobody else knows how to do this, the AIs don't know how to do even small basic building blocks of this, there are no similar repos, and I have self-doubts because I went against my new-found and successful principle
and also my brain feels restless and stressed as fuck because brain issues activated maybe due to change of drugs
so I kind of wanna explode and scream
and then maybe cry
and then maybe I'll exhaust myself and be able to focus again
rant
ragh