Wednesday, March 16, 2022

Swift 5.6 Released

Ted Kremenek:

Swift 5.6 enhances the language through a number of proposals from the Swift Evolution process, including:

  • SE-0290 - Unavailability Condition
  • SE-0315 - Type placeholders (formerly, “Placeholder types”)
  • SE-0320 - Allow coding of non String / Int keyed Dictionary into a KeyedContainer
  • SE-0322 - Temporary uninitialized buffers
  • SE-0324 - Relax diagnostics for pointer arguments to C functions
  • SE-0331 - Remove Sendable conformance from unsafe pointer types
  • SE-0335 - Introduces existential any
  • SE-0337 - Incremental migration to concurrency checking

Nick Lockwood:

I have very mixed feelings about the introduction of the any keyword for protocols in Swift[…]

Of all the changes in recent memory, this is probably the most disruptive to code compatibility (yes, technically it’s only a warning, but warnings matter)


I don’t necessarily disagree that this makes it clearer what’s going on, but aside from the effect on existing code, it impacts API compatibility forevermore.

A common refactor as APIs evolve is to convert concrete types in the interface to protocols (e.g. to make them testable)

That used to be a mostly non source-breaking change, but now it would require all call sites to be updated.


Update (2022-03-23): Steve Troughton-Smith:

This is a pretty crummy bug to ship

Daniel Martín:

Xcode 13.3 has a new tool, xcdebug, which allows you to quickly debug programs or Xcode schemes from a Unix shell.

Update (2022-04-11): TheCodingart:

FB9963451 Has been filed due to a bug found in Swift 5.6 when compiling enums with mixed associated types (some with and some without associated types) causing exponentially large compilation time increases.

Ole Begemann:

I can bring macOS to beachball on an M1 Pro by building the Swift compiler in Terminal. It’s great that this uses all 10 cores at 100%, but it seems the scheduler should leave some cycles to other apps?

Toomas Vahter:

Therefore, when reading about existential any it is possible that we get a feeling like we should, because of performance, replace everything, what is possible, with generics. But that should not be a case. Performance becomes relevant only in areas where we need to call a loooot of functions in a very short time.

Comments RSS · Twitter

Leave a Comment