TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Osaka.rs – Rust async without the noise

65 pointsby freeman478over 6 years ago

1 comment

Ruskyover 6 years ago
This post is full of misinformation. Reposting my reply from Reddit:<p>&gt; what the futures.rs authors decided to do: cram futures.rs into std and add an entire language feature to hide the bloat behind a code generator.<p>First the post establishes a problem with `futures-rs`- combinators and their associated binary bloat. Then in this quote it assumes that the bloat will carry over to the std-based futures used for async&#x2F;await, even though the express purpose of std futures and async&#x2F;await is to <i>replace</i> combinators with exactly what the author wants- generators.<p>&gt; the rust equivalent would be slightly uglier, because generators can’t have continuation arguments<p>The next thing it assumes will carry over is the thread-local executor. (Or that&#x27;s how I read it; it&#x27;s a little unclear- maybe it means tokio&#x27;s default executor?) But this complaint <i>also</i> doesn&#x27;t apply to async&#x2F;await, which has converted to an executor argument (`Waker`) to `Future::poll`, which is again <i>exactly</i> what the author wants- a continuation argument to the generator.<p>&gt; its in no way fancy, but has two significant advantages over async&#x2F;await. Firstly, it emits a generator without a specific execution engine.<p>&gt;<p>&gt; Secondly, Result just works as intended. There’s no need to wrap it in FutureResult because no such type exists.<p>&gt;<p>&gt; Lastly, sync is just: [polling and yielding in a loop] so anything that returns Ready&#x2F;Again is sync. There is no task queue, no singleton, nothing ‘magic’.<p>These last criticisms of futures and async&#x2F;await are the most baffling. Futures have <i>always</i> been agnostic to the execution engine, even in the 0.1 form, to a greater degree than osaka. The std version of futures <i>already</i> just uses `Result`. And `await` <i>is</i> just polling and yielding in a loop. The task queue is osaka&#x27;s `yield poll.again(..)`, the (actually non-)singleton is osaka&#x27;s `poll` argument, and the &quot;magic&quot; is that `poll` is only accessible from manual `Future::poll` impls.<p>This all seems like <i>very</i> surface-level stuff to me- hardly something that would prevent anyone from using async&#x2F;await on embedded. The execution model is identical. I saw [this tweet](<a href="https:&#x2F;&#x2F;twitter.com&#x2F;arvidep&#x2F;status&#x2F;1092818400798298114" rel="nofollow">https:&#x2F;&#x2F;twitter.com&#x2F;arvidep&#x2F;status&#x2F;1092818400798298114</a>) saying &quot;you cannot create a push based executor&quot; and [this tweet](<a href="https:&#x2F;&#x2F;twitter.com&#x2F;arvidep&#x2F;status&#x2F;1092823133390864385" rel="nofollow">https:&#x2F;&#x2F;twitter.com&#x2F;arvidep&#x2F;status&#x2F;1092823133390864385</a>) saying &quot;any [Future-based] alternatives need to look like tokio,&quot; but it&#x27;s unclear to me exactly what is changing here, compared to existing embedded uses of async&#x2F;await.
评论 #19106758 未加载
评论 #19106299 未加载