Issue #198 18 Nov 2021
Written by: Kristaps Grinbergs
The holiday season is just around the corner. Most of us enjoy Thanksgiving right before Christmas. For others, the festivities start after Christmas and continue even after New Year’s Eve. Despite the differences, we should all enjoy some time off with our families and friends and for this period, merge access will be locked down in Swift. Check out the holiday schedule and plan your work accordingly.
There is a new feature in Xcode 13.2 beta which makes build times much faster by using more CPU cores. This new build system is opt-in, so you’ll have to enable it.
Before we jump into other detailed news, I would like to express my gratitude to our sponsors who have helped us to run this project for the rest of the year. We would not be here without your support.
Rapidly ship in-app messaging with Stream’s highly reliable chat infrastructure and feature-rich SDKs. Drive in-app conversion, engagement, and retention.
In episode 108 of the Swift by Sundell podcast, Marin Todorov, joins John Sundell. They discuss Swift’s new concurrency system and its newly announced backward compatibility, his new book about that topic, and his work on Apple’s open source documentation tool, Swift-DocC.
News and community
John Sundell announced CollectionConcurrencyKit - a lightweight Swift package that adds asynchronous and concurrent versions of the standard
forEach APIs to all Swift collections that conform to the
He wrote an article explaining how to build async and concurrent versions of
The review discussion centered on the complexity of the initialization model, and has uncovered a simpler model that should be easier to reason about. The Core Team has returned this proposal for revision to investigate this new model. Thank you to everyone who participated!
Proposals in review
The concepts of time can be broken down into three distinct parts:
- An item to provide a concept of now plus a way to wake up after a given point in time
- A concept of a point in time
- A concept of a measurement in time
These three items are respectively a clock, an instant and a duration. The measurement of time can be used for many types of APIs, all the way from the high levels of a concept of a timeout on a network connection, to the amount of time to sleep a task. Currently, the APIs that take measurement of time types take
DispatchTimeInterval, and even types like
Filter using keypath notation makes functional programming much more succinct and readable in Swift.
However, there is not an intuitive standard library way to filter by the opposite of the boolean. I previously proposed
.isFalseand was met with reasonable push back.
Karl proposed two minor additions to
- Filling buffers
- Static member syntax
Capturing groups are a commonly used component of regular expressions as they allow the programmer to extract information from matched input. A capturing group collects multiple characters together as a single unit that can be backreferenced within the regular expression and accessed in the result of a successful match.
Joseph Heck started a discussion about the terminology questions - behaviors, shells, and possible reductions.
I’ll caveat this with “Yep, these could be all implementation details”. In starting to dig through the source for swift-distributed-actors, there are some things I knew the concepts for (basic actor concept, mailboxes, and messages). The distributed actors code steps it up a bit, and uses some terms and phrasing that I wasn’t very familiar with. I could guess and infer quite a bit, but I thought it might be best to ask about the specific terms and how they’re inter-related.
Ethan Kusters addressed improvements for the presentation of non-framework documentation.
Not all documentation built by Swift-DocC is for frameworks. Today, Swift-DocC will build documentation for any symbol graph input it is provided, which is what allows for custom workflows like Swift-DocC’s user documentation on Swift.org. However, Swift-DocC always describes this documentation as a “Framework” on the top-level page, regardless of the contents of that symbol graph.
For example, Swift-DocC’s user documentation on Swift.org is currently described as a “Framework” on the top-level page when the documentation on that page is about using DocC as a “Tool”, not as a “Framework”.
Swift Package Manager (here after SwiftPM) was released when Swift was made open source in 2016. SwiftPM uses a file named
Package.swiftwith which users describe the package’s source structure, the build artifacts such as any executables or libraries the build produces, and any dependencies on other packages.
SwiftPM’s manifest is a Swift program (a script of sorts) which SwiftPM builds and executes as a separate process in a security sandbox to generate a static data model representing the desired package configuration. Currently, the static representation is based on JSON and the exact format of that JSON is an internal implementation detail. The JSON model is later deserialized and loaded into the parent process memory space, driving SwiftPM’s workflows such as the dependency resolution, build, test , etc.
This proposal is focusing only on the isolation rules necessary to support distributed actors, and is split out from the large overall Distributed Actors pitch 8. Our intent is to propose the various pieces of that very large pitch, as individual yet interconnected proposals, similar to how Swift Concurrency was introduced last year. This way we hope to keep the amount of content reviewable, and also discussions focused on the specific topics at hand.
Existential types in Swift have an extremely lightweight spelling: a plain protocol name in type context means an existential type. Over the years, this has risen to the level of active harm by causing confusion, leading programmers down the wrong path that often requires them to re-write code once they hit a fundamental limitation of value-level abstraction. This proposal makes the impact of existential types explicit in the language by annotating such types with