This is a major new release that adds an expressive macro system to the language and introduces support for integrating Swift into C++ codebases through bidirectional interoperability.
It also introduces parameter packs, an improved expression evaluator while debugging, enhanced crash handling, Windows platform improvements, and more.
Read on for a deep dive into changes to the language, standard library, tooling, platform support, and next steps for getting started with Swift 5.9.
Thank you to everyone in the Swift community who made this release possible. Your Swift Forums discussions, bug reports, pull requests, educational content, and other contributions are always appreciated!
First, for backtrace support on macOS, this setting is mentioned: SWIFT_BACKTRACE=enable=yes. This syntax seems odd (two equals?), and it isn't clear where to add it. I assume this is an environment variable?
Second, there's this statement about breakpoint support:
Swift expressions can now refer to generic type parameters. This allows setting a conditional breakpoint in a generic function that only triggers when a type parameter is instantiated with a specific concrete type.
Could we get an example? There is no Swift syntax for a typed version of a generic function, so how does this work?
I believe the Docker images should be available soon (see /download), but we should maybe make this more clear in the installation instructions as well.
Swift allows using type parameters, e.g. as metatypes, in expressions inside the implementation of a generic type or function. This is referring to enabling the same ability in the LLDB expression evaluator. For example, if you're inside a generic function func test<T>() { ... }, you can set a conditional breakpoint that will hit when T.self == Int.self, or you can p T.self to see the underlying type of T when you're at a breakpoint inside this function.
Not sure if it belongs here but Documentation doesn't contain any mention about Type and Value parameter packs, repeat pattern, generally nothing about variadic generic support?
The ergonomics of this are confusing. Is there a clear definition for newbies to explain why repeat is sometimes there and sometimes not and when it belongs inside parentheses and when it doesn’t?
“Variadic generic parameter packs are spelled each T. Whenever you want to use them, you write repeat and then the type or expression containing each T. This shows which part of the code should be repeated for each member of the pack.”