Menu
Swift language speeds standard library, reworks generics

Swift language speeds standard library, reworks generics

Swift 5.7 features a smaller and faster standard library, usability improvements, and a new generics implementation that boosts performance and removes long-standing bugs.

Credit: Dreamstime

Swift 5.7, the latest update of Apple’s Swift programming language, is now available, with usability improvements, a smaller and faster standard library, faster build and launch times, and a new generics implementation.

Unveiled September 12, Swift 5.7 offers language and standard library enhancements including a new shorthand syntax for common boilerplate code, including if let statements and multi-statement, closure-type annotations. 

The language’s developers also lifted long-standing language limitations to make generic programming more seamless, and they enhanced data race safety with new annotations and opt-in diagnostics. New language support and APIs are offered for string processing. Yet another language improvement is actor isolation in distributed environments.

For generics, the type checker’s generics implementation has been rewritten, providing improvements to performance and correctness. With certain configurations of protocols and associated types, type-checking time would increase exponentially in Swift 5.6 but now increases only linearly in Swift 5.7. 

Swift’s new generics implementation fixes many longtime bugs, mostly related to handling of complex same-type requirements, such as those on a collection’s SubSequence associated type, and code using the CaseIterable protocol, which defines the requirement, Self.Element == Self.

Swift binaries can be downloaded from swift.org.

Meanwhile, automatic reference counting is more user-friendly, predictable, and performant, through specifying new rules to shorten the lifetime of variables when optimisation is permitted. To enforce the new rules, the compiler adopted a new internal representation that tracks the lexical scope of each variable.

In addition, code completion of function call arguments, global functions, and variables now is tightly integrated into the Swift type checker, allowing code completion to offer more accurate results inside ambiguous code or code with errors.

Also, the Windows toolchain has fully adopted swift-driver as the compiler driver. The C++ driver no longer is packaged or provided as a fallback. Also for Windows, the installer has been improved for deploying module-maps and packaging files, reducing the size of the installer download.


Follow Us

Join the newsletter!

Or

Sign up to gain exclusive access to email subscriptions, event invitations, competitions, giveaways, and much more.

Membership is free, and your security and privacy remain protected. View our privacy policy before signing up.

Error: Please check your email address.

Tags softwareSwift

Events

EDGE 2023

EDGE is the leading technology conference for business leaders in Australia and New Zealand, built on the foundations of collaboration, education and advancement.

WIICTA 2023

ARN has celebrated gender diversity and recognised female excellence across the Australian tech channel since first launching WIICTA in 2012, acknowledging the achievements of a talented group of female front runners who have become influential figures across the local industry.

ARN Innovation Awards 2023

Innovation Awards is the market-leading awards program for celebrating ecosystem innovation and excellence across the technology sector in Australia.

Show Comments