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

‘Massive’ Swift 5.5 release fixes ‘pyramid of doom’ and more
Ryan is an editor at TechForge Media with over a decade of experience covering the latest technology and interviewing leading industry figures. He can often be sighted at tech conferences with a strong coffee in one hand and a laptop in the other. If it's geeky, he’s probably into it. Find him on Twitter: @Gadget_Ry

Apple has debuted Swift 5.5, a “massive” release that fixes its “pyramid of doom” issue among introducing other major changes.

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

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

The fix implemented in Swift 5.5 was to adopt the async/await pattern seen in C#, JavaScript, Python, and others. Anonymous closures are also implicitly async if they feature an await expression.

‘Actors’ have also been introduced that allow you to “declare that a bag of state is held within a concurrency domain and then define multiple operations that act upon it.” The data of each actor is protected through data isolation to ensure only a single thread will access it at any given time.

As part of the new concurrency model, “actors provide the same race and memory safety properties as structured concurrency, but provide the familiar abstraction and reuse features 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 headline feature that’s worth digging into a little bit more is package collections.

A package contains Swift source code files and a manifest. As the name suggests, a package collection gathers several together for convenience. “We envision educators and community influencers publishing package collections to go along with course materials or blog posts, removing the friction of using packages for the first time and the cognitive overload of deciding which packages are useful for a particular task,” states the original proposal.

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

Head this way for the downloads.

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

Tags: , , , , , , , , , ,

View Comments
Leave a comment

Leave a Reply

Your email address will not be published. Required fields are marked *