View this email in your browser
 

Swift Weekly Brief

Issue #193

By Kristaps Grinbergs

California streaming. We all know what that means: a big day is coming next week - Apple has announced an event on September 14! They hid an easter egg inside the event invitation - a hidden AR experience, and it looks pretty cool. This also allowed fans across the globe to speculate about what upcoming products Apple is going to announce. It was suggested that the rose gold color of the skies inside the portal gives us the first glance of the new iPhone’s colors. Well, we’ll find out in less than a week.

The last two weeks have been full of activities in the Swift community. Many proposals are being generated in Swift evolution; some have been accepted or returned, and some are still in review. These proposals help to facilitate Swift remaining a modern language, so let’s keep them rolling!

I want to thank everyone in the Swift community involved in this project. If you want to support our newsletter financially, please reach out as we have a few sponsorship slots available.

Interested in sponsoring Swift Weekly Brief? Learn more here.

News and community

John Sundell wrote an article explaining conditional compilation within Swift expressions.

Gabriel Theodoropoulos wrote a blog post explaining how to use variadic parameters in Swift.

Commits and pull requests

Doug Gregor merged a pull request that adds an option to build the concurrency library for back deployment.

FW merged a pull request that implements semantic highlighting for Swift.

Accepted proposals

SE-0321 Package Registry Service - Publish Endpoint was accepted.

SE-0304 Structured Concurrency fourth review was accepted.

Returned proposals

SE-0320 has been returned for revision.

The feedback from the review was positive, and members of the community suggested several improvements that the author and core team felt would be good to adopt:

  1. Adding conformance for String and Int to CodingKeyRepresentable which will allow the natural use of String and Int keys when CodingKeyRepresentable is used as a generic constraint.
  2. Make the initializer of the CodingKeyRepresentable protocol be generic.
  3. Provide default implementations for the conformance for RawRepresentable (with String and Int raw values).
  4. Make the initializers of the internal _DictionaryCodingKey non-failable.

Proposals in review

SE-0320: Coding of non String / Int keyed Dictionary into a KeyedContainer is under a second review.

The second review is focused on the proposed improvements made by the community during the first review, and addressed by swift-evolution#1435.

SE-0292: Package Registry Service amendment is under review.

SE-0303: Package Manager Extensible Build Tools amendment is under review.

SE-0322: Temporary Uninitialized Buffers is under review.

This proposal introduces new Standard Library functions for manipulating temporary buffers that are preferentially allocated on the stack instead of the heap.

Swift-evolution thread: [Pitch] Temporary uninitialized buffers

Swift Forums

Michael Verges pitched a proposal to add optional throws in Swift.

There are many cases when jurisdiction of error handling is unclear. Developers may question whether to handle or propogate errors.

Choosing to throw errors provides the benefit that callers can flexibly handle problems.

Choosing to not throw errors provides the benefit of simplifying syntax to users (no do-try-catch).

Karl informed the community about WebURL version 0.2.0.

I’m getting ready to release version 0.2.0 of WebURL. It’s going to be an exciting and important release, including a WebURLSystemExtras module for integration with System.framework and the swift-system package, and aligning the project with the very latest revision of the URL Standard.

Patrick Goley pitched a proposal to add destructuring assignment of structs and classes.

Destructuring assignment is a language feature that allows you to extract multiple parts of a value and assign them to multiple variables within a single assignment statement.

Steve Canon announced that the first stable release of Swift Numerics is now available.

Austin started a conversation about netlink socket support in SwiftNIO.

Konrad ktoso Malawski pitched a proposal to implement distributed actors.

With the recent introduction of Swift concurrency, and most notably actors to the language, Swift gained powerful and foundational building blocks for expressing thread-safe concurrent programs. This proposal aims to extend Swift’s actors with the ability to work equally well for distributed systems thanks to the introduction of distributed actors and location transparency associated with them.

Max Desiatov informed us that SwiftWasm 5.4.0 is out.

This release matches upstream Swift 5.4, and allows you to compile Swift apps (as long as they don’t use code specific to other platforms) to WebAssembly, and even run them in the browser.

elsh pitched a proposal to add module aliasing support.

As Swift libraries and packages are more widely distributed, module names sometimes end up clashing. As there’s no module namespace yet in Swift, libraries are often forced to be renamed or pinned to an older non-conflicting version in such case. This makes use cases such as the following challenging:

  • Adding a new dependency or upgrading as it can introduce a collision: A new (or upgraded) module can have the same name as another module already in the dependency graph. Module name Logging is a common example.

  • Upgrading to a newer version of a package from an older version pinned by an upstream library: Consider a scenario where MyApp depends on module Lib, and Lib depends on module Logging. MyApp also depends on Logging. If Lib is pinned to Logging 1.0.0, MyApp is stuck with the same version 1.0.0.

Swift on the Server Workgroup, on September 3rd, 2021, announced a special update.

Isabel Lima updated us about the status of the Shared Storage for Property Wrappers pitch.

Swift is a language that allows us to write expressive API interfaces. With features like constrained Generics, method overloading, trailing closures, and default arguments, you can reduce code duplication while still achieving quite flexible APIs. This proposal aims to increment this part of the language with @expanded, a new attribute for function parameters.

John Holdsworth proposed adding an Unwrap or Throw operator.

This thread is the love child of two previous contentious threads [Pitch] Introducing the “Unwrap or Die” operator to the standard library 2 and more recently Moving toward deprecating force unwrap from Swift?. The latter thread did not reach a conclusion other than being locked and this thread picks up on the former thread proposing instead an “Unwrap or Throw” operator might be a better solution to the problem of forced unwraps in Swift which bugs me and I’m sure it bugs our users when their apps crash out.

In short, I’d like to propose a !! operator, a cross between a forced unwrap and nil coalescing that throws if an optional is nil..

Finally

welsh for “dependency injection”.


Open in browser »
Newsletter hosting by AppForce1.
Copyright © [currentyear] Swift Weekly Brief, All rights reserved.
You are receiving this email because you opted in via our website.
You can unsubscribe here.