• 30p87@feddit.de
    link
    fedilink
    arrow-up
    0
    ·
    9 months ago

    async/await could be useful if one creates an entire program designed on and for it, but it stops being acceptable as soon as I need two .thens inside of each other because I tried to use fetch in a non-async app without race conditions

  • AggressivelyPassive@feddit.de
    link
    fedilink
    arrow-up
    0
    ·
    9 months ago

    I honestly don’t know, why async got so popular. It seems like the entire reason for doing it was that some blokes were hellbent on using JS on a server and couldn’t fathom that a second thread might be a good idea.

    • PlexSheep@feddit.de
      link
      fedilink
      arrow-up
      0
      ·
      edit-2
      9 months ago

      Async rust with the Tokio Framework is pretty cool. Need none of that JS bloat for async.

      • RustyNova@lemmy.world
        link
        fedilink
        arrow-up
        0
        ·
        9 months ago

        Honestly I can’t wrap my head how to effectively put computation into a thread, even with Tokio.

        All I want is something like rayon where you got a task queue and you just yeet tasks into a free thread, and await when you actually need it

        Might be too much JS/TS influence on me, or that I can’t find a tutorial that would explain in a way that clicks for me

        • PlexSheep@feddit.de
          link
          fedilink
          arrow-up
          0
          ·
          9 months ago

          Tokio is for concurrency, not parallelism. Use it for IO stuff. They say rayon is good for that, but I haven’t used that. If you just want something simple, I’d recommend working with threadpool.