GNU social JP
  • FAQ
  • Login
GNU social JPは日本のGNU socialサーバーです。
Usage/ToS/admin/test/Pleroma FE
  • Public

    • Public
    • Network
    • Groups
    • Featured
    • Popular
    • People

Embed Notice

HTML Code

Corresponding Notice

  1. Embed this notice
    Ako Suminoe :njp: (realakosuminoe@poa.st)'s status on Tuesday, 21-Feb-2023 00:40:16 JSTAko Suminoe :njp:Ako Suminoe :njp:
    in reply to
    • Alex Gleason
    @alex I generally don't even look at SO because its full of bad takes.

    Making it possible to do turn an async operation into a sync operation would become a really easy way for developers to do the wrong thing, and potentially block the main thread with a long running operation. The web specs are designed defensively for an environment where there are lots of 3rd party scripts on most pages, each with the ability to theoretically break things. It may suck for some things, but giving developers an easy way to do the wrong thing guarantees that people will do the wrong thing. We want more things to be async, not less.

    We can't just make every function asynchronous and get rid of async/await all together because we still need to have a Promise primitive to get any benefits from it. You couldn't do something like this if everything were automatically await'ed:

    var taskA = heavyTask1(); // starts A
    var taskB = heavyTask2(); // starts B in parallel with A

    var resultA = await taskA;
    var resultB = await taskB;
    // OR
    var [resultA, resultB] = await Promise.all([taskA, taskB])

    If taskA encounters a network request, it can run taskB while it waits for the result and then switch back to taskA.
    In conversationTuesday, 21-Feb-2023 00:40:16 JST from poa.stpermalink
  • Help
  • About
  • FAQ
  • TOS
  • Privacy
  • Source
  • Version
  • Contact

GNU social JP is a social network, courtesy of GNU social JP管理人. It runs on GNU social, version 2.0.2-dev, available under the GNU Affero General Public License.

Creative Commons Attribution 3.0 All GNU social JP content and data are available under the Creative Commons Attribution 3.0 license.