@holly@hachyderm.io
@holly@hachyderm.io avatar

holly

@holly@hachyderm.io

👩🏻‍💻 Engineering manager of the Swift language team @ Apple. Member of the open source #SwiftLang Core Team, Language Workgroup, and Diversity in Swift Workgroup. 👩🏻‍🏫 Interested in education, and mentorship in open source communities. 🩰 Classical ballet enthusiast.

This profile is from a federated server and may be incomplete. Browse more on the original instance.

Migueldeicaza, to random
@Migueldeicaza@mastodon.social avatar

Good post by @heckj on what he learned and the tradeoffs he did when designing an API for strict swift concurrency support.

The best part are the regrets he has, good guidance for those of us starting on our strict journey:

https://rhonabwy.com/2024/04/29/designing-a-swift-library-with-data-race-safety/

holly,
@holly@hachyderm.io avatar

@Migueldeicaza @krzyzanowskim @heckj it’s because the type of the global variable is not Sendable. Initialization of globals is thread-safe, but if the value has, say, reference types with mutable state, then you can still get concurrent mutations.

holly, to random
@holly@hachyderm.io avatar

I had a lot of fun chatting about Swift 6 and data-race safety with @daveverwer and @finestructure! I’m grateful for the opportunity to share my insights, and to everyone who has shared their experience and shaped my thinking on approaching the Swift 6 migration. Special thanks to @mattiem, @groue, and @cocoaphony for your perspective and feedback, and encouraging others to learn along with you!
https://mas.to/@SwiftPackageIndex/112332307639949991

holly, to random
@holly@hachyderm.io avatar

I was supposed to go to a bachelorette party in Mexico this weekend but I got sick so I stayed home. My husband said he’s going to lock my laptop away to still force me to take a break. I thought it was a funny joke.

This morning when I woke up, he was in my home office with the door closed and has been in meetings since then. With my laptop 🤔

holly,
@holly@hachyderm.io avatar
tonyarnold, to random
@tonyarnold@mastodon.social avatar

I agree with @everything in his post on the forums: https://forums.swift.org/t/asyncstream-and-actors/70545/4

My take: Swift Concurrency has gone from being somewhat understandable to being really, really hard to apply and understand properly.

I get that we can stick with Swift 5 language mode, but none of us wants to do that.

I hope that WWDC brings some understandable instruction alongside improved tooling, because right now we're all reliant on @mattiem sharing what he has worked out (thanks Matt!).

holly,
@holly@hachyderm.io avatar

@tonyarnold Confusing error messages are compiler bugs - please report them! There’s room for improvement in probably every compiler error. Reporting them as bugs is important because there are thousands of these messages in the compiler, so I need signal on what’s confusing folks to understand how to best prioritize.

Anyway, initializing isolated state is on my list since a bunch of folks have posted forum threads about it. Also, compiler notes to show where global actors are inferred from.

holly,
@holly@hachyderm.io avatar

@bnut I’m working on a concurrency guide that explains data-race safety concepts from first principles over at https://github.com/hborla/swift-org-website/blob/concurrency-migration-guide/documentation/concurrency/index.md.

This is very much incomplete and not ready for feedback yet, but I’ll put up a PR against swift-org-website once it is.

holly, to random
@holly@hachyderm.io avatar

If you’ve ever struggled with task ordering due to tasks always starting on the global concurrent executor, this pitch from @rjmccall is for you: https://forums.swift.org/t/isolated-any-function-types/70562

This changes the task creation APIs to synchronously enqueue directly on the isolated actor so that explicitly isolated tasks with the same priority are guaranteed to start in the order you create them.

holly, to random
@holly@hachyderm.io avatar

A fantastic post from @cocoaphony on the role of @preconcurrency in the elimination of data races across the Swift ecosystem: https://forums.swift.org/t/types-that-must-be-mainactor-but-cannot-be-mainactor-due-to-protocol-conformance/70507/9

There’s a massive amount of Swift code out there, and the transition to complete concurrency will be incremental. @preconcurrency denotes where you’re relying on code that doesn’t yet have static checking, so dynamic checks are inserted. You’ll get a warning when that changes so you can remove the annotation, and uses will disappear over time.

cocoaphony, to random
@cocoaphony@mastodon.social avatar

On the recent corner I've gotten myself into with Swift concurrency. I'm not sure how to deal with non-isolated protocol conformance on MainActor types when I don't control the protocol.

I'm open to "here's another way to implement the same thing that does work," but I'm a little nervous that this might be a more general problem that will come up more.

cc: @holly

https://forums.swift.org/t/types-that-must-be-mainactor-but-cannot-be-mainactor-due-to-protocol-conformance/70507

holly,
@holly@hachyderm.io avatar

@cocoaphony @helge @mattiem Yeah MainActor.assumeIsolated is the way to say “trust me I know this is always on the MainActor at runtime even if the protocol in my dependency hasn’t been annotated yet”. We also have a proposal under review to alleviate some of the boilerplate for this pattern: https://forums.swift.org/t/se-0423-dynamic-actor-isolation-enforcement-from-non-strict-concurrency-contexts/70155

Over time, the need for dynamic actor isolation checking will be mitigated as more of the ecosystem moves to the static isolation world!

holly, to random
@holly@hachyderm.io avatar

Swift 5.10 is here: https://www.swift.org/blog/swift-5.10-released/

This is a huge milestone for data-race safety in Swift. But there's still work to do - lifting restrictions, writing migration guides, and building a shared understanding of safe concurrent code patterns.

If you find warnings that you don't understand or don't know how to resolve, please let me know! You can start a discussion on the Swift Forums with the concurrency tag at https://forums.swift.org/tags/c/swift-users/15/concurrency, or file an issue at https://github.com/apple/swift/issues/new/choose.

holly, to random
@holly@hachyderm.io avatar

I sat down to write a Swift evolution proposal. There was a sleeve of thin mints on my desk. The proposal draft is now written, and the thin mints are gone. I have no idea what happened.

holly, to random
@holly@hachyderm.io avatar

Let's talk about data race safety in Swift 6!

The Swift 6 language mode is opt-in; you can continue to use Swift 5 mode with the Swift 6 compiler. You can incrementally refine your code to take advantage of full data isolation at your own pace, module by module. Swift 6 code can depend on libraries using Swift 5 and vice versa.

If you're not familiar with Swift concurrency and data isolation, that's okay! There's no rush, and the language mode will be there when you're ready to take it on.

mattiem, to random
@mattiem@mastodon.social avatar

Everyone is taking about enabling Swift concurrency complete checking! I wrote up some thoughts to help you decide if you should do it.

https://www.massicotte.org/complete-checking

holly,
@holly@hachyderm.io avatar

@jsq @mattiem The Swift 6 compiler will still support the Swift 5 language mode, just as the Swift 5 compilers still support the Swift 4 and 4.2 language modes. The purpose of the Swift 6 language mode is enforcing data race safety by default, so if you don’t want that, you’ll continue to use Swift 5 mode. If you want to enable a specific source breaking change from Swift 6 in Swift 5 mode (say, full error type inference for typed throws), you can do that with upcoming feature flags.

holly, to random
@holly@hachyderm.io avatar

My perfect Sunday morning: drinking coffee, watching love island, and answering concurrency questions on the Swift forums

holly,
@holly@hachyderm.io avatar

@siracusa I’m watching love island all stars! Not quite as good as classic love island UK but it’s fun to see a bunch of islanders from previous seasons

holly,
@holly@hachyderm.io avatar

Miss Georgia Steel serving necessary drama. Interesting discussions about staging in Sendable annotations in a library without breaking clients.

holly, to random
@holly@hachyderm.io avatar

An update on progress toward Swift 6: https://forums.swift.org/t/progress-toward-the-swift-6-language-mode/68315

Swift 6 will only be ready when it’s usable and the migration is approachable.

Better Sendable inference and ways to safely transfer non-Sendable values will eliminate many false positive data race errors. We’re also exploring ways to mitigate repetitive annotations, such as by allowing preconcurrency APIs to defer actor isolation checking to runtime to streamline the ‘nonisolated + assumeIsolated’ pattern.

holly, to random
@holly@hachyderm.io avatar

Many patterns that transfer non-Sendable values into an actor isolated context are perfectly safe, but Sendable checking is too strict. This pitch enables these patterns using isolation regions: https://forums.swift.org/t/pitch-region-based-isolation/67888.

When it’s proven safe, your code will compile. When it’s not, the compiler will pinpoint the potential concurrent access to help you eliminate it.

This work adopted the ideas in A Flexible Type System for Fearless Concurrency from 2022: https://www.cs.cornell.edu/andru/papers/gallifrey-types/

icanzilb, to random
@icanzilb@mastodon.social avatar

Ok... I spent two days trying to figure out why my macro crashes with EXC_BAD_ACCESS but still no idea. I feel that the debugging process can be improved somewhat because all I get is a crash that really gives me no leads 🤔

holly,
@holly@hachyderm.io avatar

@icanzilb Thanks for posting about this! The macro expansion is invalid — freestanding declaration macros can only produce declarations and not statements — but the compiler wasn’t diagnosing this. I’ve put up a fix:

https://github.com/apple/swift/pull/69089

holly,
@holly@hachyderm.io avatar

@icanzilb please report them at https://github.com/apple/swift/issues. Feel free to tag me once you do!

mattiem, to random
@mattiem@mastodon.social avatar

Does anyone understand why I don't get a warning here? I'm explicitly capturing a non-sendable value in a @Sendable closure and I have all the warnings on.

https://gist.github.com/mattmassicotte/d0b2b4eddf7c0c2ca7bdf3d516bb5f86

holly,
@holly@hachyderm.io avatar

@mattiem @dehesa Ah, global variables currently don’t have any Sendable or actor isolation restrictions, which means they’re data-race prone. This hole in the model will be filled by https://forums.swift.org/t/pitch-strict-concurrency-for-global-variables/66908

twostraws, to random
@twostraws@mastodon.social avatar

Dear men: If you are invited to speak at a conference, it is a huge privilege and I hope you’re excited. But please, please pause before you accept to check the list of other speakers – too many Swift events are happening with the most extraordinary gender imbalance, and it’s bad for everyone. I know you want to travel, present, meet people, and have fun, but please use your privilege to help ensure everyone is included. When we’re building apps for everyone, everyone needs to be in the room 🌈

holly,
@holly@hachyderm.io avatar

@twostraws One of* the reasons I’ve had major speaking roles, and major engineering opportunities in general, is because men who would’ve been chosen advocated for others instead. One of the most powerful things you can do is use your influence to surface opportunities to folks who would otherwise be overlooked for reasons unrelated to their technical expertise.

*the other reason is I’m qualified: I’m a good speaker and I deeply understand the technical topics. But that’s not always sufficient.

holly, to random
@holly@hachyderm.io avatar

I am unreasonably excited about this pitch for generalized tuple conformances, built on top of parameter packs. Hashable tuples here we come!!!

https://forums.swift.org/t/pitch-user-defined-tuple-conformances/67154

holly, to random
@holly@hachyderm.io avatar

Lots of concurrency usability improvements pitched to Swift Evolution today 👀

Sendable inference for unapplied and partially applied methods: https://forums.swift.org/t/pitch-inferring-sendable-for-methods/66565

Safely sending non-Sendable values across isolation domains: https://forums.swift.org/t/pitch-safely-sending-non-sendable-values-across-isolation-domains/66566

holly, to random
@holly@hachyderm.io avatar

The best bug fixes are the ones that prompt you to clean up technical debt from 6 years ago

https://github.com/apple/swift/pull/66657

holly,
@holly@hachyderm.io avatar

Also keep the parameter pack bug reports coming!!! These are fun to fix 😄

  • All
  • Subscribed
  • Moderated
  • Favorites
  • JUstTest
  • kavyap
  • DreamBathrooms
  • thenastyranch
  • magazineikmin
  • tacticalgear
  • Durango
  • Youngstown
  • modclub
  • slotface
  • rosin
  • ethstaker
  • mdbf
  • ngwrru68w68
  • megavids
  • InstantRegret
  • everett
  • osvaldo12
  • GTA5RPClips
  • anitta
  • khanakhh
  • cubers
  • normalnudes
  • tester
  • cisconetworking
  • provamag3
  • Leos
  • lostlight
  • All magazines