‘Massive’ Swift 5.5 release fixes ‘pyramid of doom’ and more

Apple has debuted Fast 5.5, a “massive” launch that fixes the “pyramid of doom” problem amid the introduction of other major changes.

An issue with the way Swift handled concurrency previously meant that a “pyramid of doom” of hard-to-follow nested calls would occur when a developer wrote multiple asynchronous operations.

The inventor of the Swift language, Chris Lattner, had previously acknowledged that error handling gets ugly “because Swift’s natural error handling mechanism cannot be used.” On a post, provided an example of what the code ends up looking like:

image

The solution implemented in Swift 5.5 was to adopt the async / await pattern seen in C #, JavaScript, Python, and others. Anonymous closures are also implicitly asynchronous if they present a wait expression.

‘Actors’ have also been introduced that allow you to “declare that a bag of state is kept within a domain of concurrency and then define multiple operations that act on it.” Each actor’s data is protected through data isolation to ensure that only one thread accesses it at any given time.

As part of the new concurrency model, “Actors provide the same race and memory security properties as structured concurrency, but provide the familiar abstraction and reuse characteristics that other explicitly declared types in Swift enjoy.”

The additions and changes in Swift 5.5 can justifiably be called “massive”. Here are the proposals that were included in the latest version:

Another main feature worth digging a little deeper is package collections.

One package contains Swift source code files and a manifest. As the name suggests, a bundle collection brings together several for convenience. “We envision educators and community influencers publishing package collections to accompany course materials or blog posts, eliminating the friction of using packages for the first time and the cognitive overhead of deciding which packages are useful for a task. in particular, “says the original proposal.

Swift 5.5 is now available in Xcode 13 or available for Ubuntu, CentOS, Amazon Linux 2, or Windows 10.

Head Here for downloads.

DevOps

Want to learn about DevOps from the leaders in the space? Review the DevOps as a Service Summit on February 1, 2022, where attendees will learn about the benefits of creating collaboration and partnerships in delivery.

Tags: apple, coding, concurrency, development, ios, language, programming, pyramid of doom, fast, fast 5.5, xcode

Leave a Comment