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

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

Conversation

Notices

  1. Embed this notice
    Sergey Shandar (functionalscript@techhub.social)'s status on Saturday, 20-Jul-2024 04:01:00 JST Sergey Shandar Sergey Shandar
    in reply to
    • Axel Rauschmayer

    @rauschma I wouldn't argue about scope of a `syntactic sugar` definition. However, an async function and generator can be transformed into `Promise` and `Iterator` implementation. Also, I agree that it's not simple, it's a good exercise to understand how generators and async functions work.

    In conversation about a year ago from techhub.social permalink
    • Embed this notice
      Axel Rauschmayer (rauschma@fosstodon.org)'s status on Saturday, 20-Jul-2024 04:01:01 JST Axel Rauschmayer Axel Rauschmayer

      The term “syntactic sugar” is tricky. Common definition: shorter syntax with a simple transformation to a longer version. Think syntax-aware search-and-replace or macros.

      Examples:

      a += b // sugar
      a = a + b // long

      {prop} // sugar
      {prop: prop} // long

      (x) => x + x // sugar
      (x) => { return x } // long

      With this definition, async/await is not syntactic sugar for Promises: An async function is executed similarly to a generator (pausing, resuming, …). So no simple transformation from .then().

      In conversation about a year ago permalink

Feeds

  • Activity Streams
  • RSS 2.0
  • Atom
  • 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.