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
    Paul Cantrell (inthehands@hachyderm.io)'s status on Tuesday, 05-Dec-2023 11:56:33 JST Paul Cantrell Paul Cantrell
    in reply to
    • Kyle Bashour
    • Joe Fabisevich :verified:
    • John McCall
    • Rob Napier
    • jesse squires
    • Quinn “The Eskimo!”

    @rjmccall @cocoaphony @mergesort @kylebshr @justkwin @jsq
    In my (so far limited) experiments with Swift concurrency, I’ve found myself getting tangled in knots fast when I try to use old habits and start my reasoning from “what thread am I on,” and get untangled by thinking about two things:

    1. What code wants to let others take a turn and come back later? (Where are the `await`s?)

    2. What data must be accessed sequentially, one piece of code at a time? (What isn’t Sendable?)

    In conversation Tuesday, 05-Dec-2023 11:56:33 JST from hachyderm.io permalink
    • Embed this notice
      John McCall (rjmccall@hachyderm.io)'s status on Tuesday, 05-Dec-2023 11:56:34 JST John McCall John McCall
      in reply to
      • Kyle Bashour
      • Joe Fabisevich :verified:
      • Rob Napier
      • jesse squires
      • Quinn “The Eskimo!”

      @cocoaphony @mergesort @kylebshr @justkwin @jsq Non-Sendability is the big tool there for when making something an actor isn’t right

      In conversation Tuesday, 05-Dec-2023 11:56:34 JST permalink
    • Embed this notice
      Rob Napier (cocoaphony@mastodon.social)'s status on Tuesday, 05-Dec-2023 11:56:35 JST Rob Napier Rob Napier
      in reply to
      • Kyle Bashour
      • Joe Fabisevich :verified:
      • John McCall
      • jesse squires
      • Quinn “The Eskimo!”

      @rjmccall @jsq @kylebshr @justkwin @mergesort I’ve been treating MainActor classes as just another kind of actor. (Maybe that’s confusing terminology?)

      But in large programs, “just not sending between concurrent domains” sounds a lot like what we’ve been doing and failing to do correctly (and the problem actors are supposed to help).

      In conversation Tuesday, 05-Dec-2023 11:56:35 JST permalink
    • Embed this notice
      Rob Napier (cocoaphony@mastodon.social)'s status on Tuesday, 05-Dec-2023 11:56:36 JST Rob Napier Rob Napier
      in reply to
      • Kyle Bashour
      • Joe Fabisevich :verified:
      • John McCall
      • jesse squires
      • Quinn “The Eskimo!”

      @justkwin @mergesort @kylebshr @jsq @rjmccall true for the community. But Apple is saying explicitly up on stage that it is “the best way to write apps.” So we’re kind of struggling. I’ve recently backed off my push in my team for “no more non-actor classes.” It turned out almost everything I tried to write required hours of research and no definite answer. So now it’s closer to “if you feel like doing the hard work of figuring it out, then it would be nice if you tried some async/await.”

      In conversation Tuesday, 05-Dec-2023 11:56:36 JST permalink
    • Embed this notice
      John McCall (rjmccall@hachyderm.io)'s status on Tuesday, 05-Dec-2023 11:56:36 JST John McCall John McCall
      in reply to
      • Kyle Bashour
      • Joe Fabisevich :verified:
      • Rob Napier
      • jesse squires
      • Quinn “The Eskimo!”

      @jsq @cocoaphony @kylebshr @justkwin @mergesort I definitely wouldn’t go so far as to say “no non-actor classes”! There are other ways to keep things isolated and thread-safe, like something isolated to the main actor, or just not sending it between concurrent domains

      But yeah, we know we owe the community a guidebook here. We’re working on it, and seeing things like is a huge hint about places to flesh out

      In conversation Tuesday, 05-Dec-2023 11:56:36 JST permalink
    • Embed this notice
      Quinn “The Eskimo!” (justkwin@toot.community)'s status on Tuesday, 05-Dec-2023 11:56:41 JST Quinn “The Eskimo!” Quinn “The Eskimo!”
      in reply to
      • Kyle Bashour
      • Joe Fabisevich :verified:
      • John McCall
      • Rob Napier
      • jesse squires

      @cocoaphony @mergesort @kylebshr @jsq @rjmccall I’m kinda reluctant to make too many pronouncements about Swift concurrency myself. We as a community are still collectively ironing out the details.

      In conversation Tuesday, 05-Dec-2023 11:56:41 JST permalink
    • Embed this notice
      Rob Napier (cocoaphony@mastodon.social)'s status on Tuesday, 05-Dec-2023 11:56:43 JST Rob Napier Rob Napier
      in reply to
      • Kyle Bashour
      • Joe Fabisevich :verified:
      • John McCall
      • jesse squires
      • Quinn “The Eskimo!”

      @mergesort @kylebshr @jsq and yet still, I can’t say 3 sentences about Swift concurrency without making 2 misstatements. Check the replies from @rjmccall and @justkwin who actually know what they’re talking about.

      In conversation Tuesday, 05-Dec-2023 11:56:43 JST permalink
    • Embed this notice
      Joe Fabisevich :verified: (mergesort@macaw.social)'s status on Tuesday, 05-Dec-2023 11:56:44 JST Joe Fabisevich :verified: Joe Fabisevich :verified:
      in reply to
      • Kyle Bashour
      • Rob Napier
      • jesse squires

      @kylebshr @jsq I can't say it better than @cocoaphony here. And if I was being held at gunpoint and these very nerdy captors said “solve this concurrency problem or we shoot but you can phone a friend”, there are few people I'd rather call on than Rob. https://mastodon.social/@cocoaphony/111520060479826953

      In conversation Tuesday, 05-Dec-2023 11:56:44 JST permalink

      Attachments

      1. Domain not in remote thumbnail source whitelist: files.mastodon.social
        Rob Napier (@cocoaphony@mastodon.social)
        from Rob Napier
        Attached: 1 image @jsq I don't know what you mean by "that is wrong." If you mean, don't use Task as if it were `dispatch`, sure, but that doesn't mean you don't use Task to move from non-concurrent code to concurrent code. And writing to disk has excellent async methods; you don't need a background anything for that. (But see next post if `saveFilesToDisk` is **computationally** expensive rather than I/O bound.)
    • Embed this notice
      jesse squires (jsq@mastodon.social)'s status on Tuesday, 05-Dec-2023 11:56:45 JST jesse squires jesse squires
      in reply to

      To clarify it is the structure of the example code that I’m interested in:

      1. Action is triggered by user via UI element.

      2. Expensive, non-main thread work needs to get dispatched to a background queue.

      3. When said work completes, dispatch back to the main thread to update the UI that notifies the user of the result.

      So now: write this using structured concurrency.

      Don’t tell me “well a ViewController should really only be responsible for…” Yeah, duh. You’re missing the point here.

      In conversation Tuesday, 05-Dec-2023 11:56:45 JST permalink
    • Embed this notice
      Kyle Bashour (kylebshr@mastodon.social)'s status on Tuesday, 05-Dec-2023 11:56:45 JST Kyle Bashour Kyle Bashour
      in reply to
      • Joe Fabisevich :verified:
      • jesse squires

      @jsq @mergesort do you have any thoughts? I think I’ve heard you say you’ve thought about concurrency quite a bit!

      In conversation Tuesday, 05-Dec-2023 11:56:45 JST permalink
    • Embed this notice
      jesse squires (jsq@mastodon.social)'s status on Tuesday, 05-Dec-2023 11:56:46 JST jesse squires jesse squires

      Swift challenge for the week:

      Given the example code, how do you correctly convert it to use Swift Tasks and Structured Concurrency?

      Let's avoid discussing how crappy the example code is — the point is that *a lot* of existing "async” UI code has this general form. This general style/convention of code is everywhere.

      I think the first thing folks will reach for is replacing the dispatch queues with `Task { }`, but according to WWDC videos and folks that work on the compiler, that is wrong.

      In conversation Tuesday, 05-Dec-2023 11:56:46 JST permalink

      Attachments


      1. https://files.mastodon.social/media_attachments/files/111/519/805/360/994/418/original/78f997e27daa2f21.png

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.