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
-
async/await is the most optimal way to do async (if it’s built into the language and is not some half assed 3rd party lib)!
-
@Demolishun yes, Swift has that. It’s called plugins.
Not sure about other languages. -
kobenz9071ybtw, @jestdotty, maybe scheme continuations is what you're after. I'm not sure, but maybe Rusty's macro systems is enough to implement it -
kobenz9071y@jestdotty hmmm 🤔 maybe it'd be expensive learning scheme just for that.
You could use fibers then!
They're already made available by the kernel and cost very little.
---
there's also a nice and tiny fibers implementation already done by Calvin Rose over at janet-lang.
https://github.com/janet-lang/...
Your C Is better than mine, I bet you could make that Rust in no time -
@retoor so what you're saying is every browser is carrying around a c compiler bundled with it?
-
I agree. Promises are a really excellent backwards compatible solution.
However, they don’t have anything to do with performance whatsoever -
@retoor "yes also rust, not by much."
Like removing the guardrails from a nine hundred foot cliff face tourist attraction.
If you want to get really close to the edge, it is the only way to do it. -
kobenz9071y@Wisecrack honestly, if you reaaaaally wanna go bareback, look no further than Zig. I can't, it's too much for me
Related Rants

Story of my life
Painfully true...
promises in JavaScript have really spoiled me
it's the most optimal way to do async without leaving much on the table
there's a promises library in rust and the guy who wrote it says it sucks because it spawns new thread every time you execute a bunch of promises
and I finally, through my fogged brain, managed to get the bright idea to write what I want to make in rust in JavaScript and holy hell it's sexy to work with promises. there's no performance left on the table. you do things as fast as possible
but if I take this JavaScript usability code I made and make it possible syntax-wise in rust I don't see how I would be able to do it without starting new operating system threads every time I execute any promises (or set)
I can take the overhead hit but this sounds retarded
and this isn't even touching upon how in rust everything needs to have a predetermined data type. so you can do lambdas and capture variables and send in variables into a thread that way, but to return the return object must be a consistent type (synchronizing the order data was sent in to the data sent out aside, haven't written that yet should be fine though)
which is fine if you are making a threadpool and it'll all be returning one data type
but this means you can't reuse a threadpool you made elsewhere in the program
the only thing that could fix async is to literally be compiler-enabled. it would have to work like generics and automatically make an enum of every type that can return, and only then could you re-use the threadpool
rant
threads